home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume11 / starchart / part32 < prev    next >
Text File  |  1990-03-25  |  52KB  |  1,771 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v11i060: starchart 3.2 Part 32/32
  3. from: ccount@ATHENA.MIT.EDU
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 11, Issue 60
  7. Submitted-by: ccount@ATHENA.MIT.EDU
  8. Archive-name: starchart/part32
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 32 (of 32)."
  17. # Contents:  starchart/starXawMwin.c
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'starchart/starXawMwin.c' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'starchart/starXawMwin.c'\"
  21. else
  22. echo shar: Extracting \"'starchart/starXawMwin.c'\" \(47939 characters\)
  23. sed "s/^X//" >'starchart/starXawMwin.c' <<'END_OF_FILE'
  24. X/*
  25. X * Mapwin edit dialogs for starXaw
  26. X *
  27. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  28. X *
  29. X * This software may be redistributed freely, not sold.
  30. X * This copyright notice and disclaimer of warranty must remain
  31. X *    unchanged. 
  32. X *
  33. X * No representation is made about the suitability of this
  34. X * software for any purpose.  It is provided "as is" without express or
  35. X * implied warranty, to the extent permitted by applicable law.
  36. X *
  37. X */
  38. X
  39. X
  40. Xstatic char rcsid[]="$Header: starXawMwin.c,v 1.7 90/03/10 15:34:13 ccount Exp $";
  41. X
  42. X#include <stdio.h>
  43. X#include <math.h>
  44. X
  45. X#include "star3.h"
  46. X#include "starXaw.h"
  47. X
  48. X#ifndef SYSV
  49. X#include <strings.h>
  50. X#else
  51. X#include <string.h>
  52. X#endif
  53. X
  54. X#include <X11/cursorfont.h>
  55. X#include <X11/Intrinsic.h>
  56. X#include <X11/StringDefs.h>
  57. X#include <X11/Shell.h>
  58. X#ifdef X11R4
  59. X#include <X11/Xaw/Command.h>
  60. X#include <X11/Xaw/Form.h>
  61. X#include <X11/Xaw/Box.h>
  62. X#define ASCII_STRING
  63. X#define XAW_BC
  64. X#include <X11/Xaw/AsciiText.h>
  65. X#else
  66. X#include <X11/Command.h>
  67. X#include <X11/Form.h>
  68. X#include <X11/Box.h>
  69. X#include <X11/AsciiText.h>
  70. X#endif
  71. X
  72. Xchar *malloc();
  73. X
  74. X#define LINELEN 82
  75. X
  76. X#define MAX(a,b) ((a)>(b)?(a):(b))
  77. X#define MIN(a,b) ((a)<(b)?(a):(b))
  78. X
  79. Xextern char *prog;
  80. X
  81. X/* Externs */
  82. Xextern int g_argc;
  83. Xextern char **g_argv;
  84. X
  85. Xextern char *title;
  86. X
  87. X/* From starchart.c */
  88. Xextern double ra, de, sc;
  89. Xextern double all_lbllim, all_maglim, all_gklim;
  90. Xextern int use_lbllim, use_maglim, use_gklim;
  91. X
  92. Xextern double all_vmin, all_vmax;
  93. Xextern int use_vmin;
  94. Xextern int nomaglbls;
  95. X
  96. Xextern double all_rstep, all_dstep;
  97. Xextern int use_rstep;
  98. Xextern double all_rstrt, all_dstrt;
  99. Xextern int no_ra_grid;
  100. Xextern int no_dec_grid;
  101. X
  102. Xextern int all_invert;
  103. X
  104. Xextern int chart_type;
  105. X
  106. Xextern int all_proj_mode;
  107. X
  108. Xextern char *rcfile;
  109. X
  110. Xextern char *constfile;
  111. Xextern char *boundfile;
  112. Xextern char boundftype;
  113. Xextern char *patternfile;
  114. Xextern char pattftype;
  115. Xextern char *cnamefile;
  116. Xextern char cnameftype;
  117. Xextern char *mapfiles[];
  118. Xextern int mapftypes[];
  119. Xextern int nummapfiles;
  120. X
  121. Xextern mapwindow *mapwin[];
  122. Xextern int numwins;
  123. X
  124. Xextern int cur_function;
  125. Xextern int cur_map_type;
  126. Xextern int cur_map_tag;
  127. Xextern char *cur_tag_field;
  128. Xextern char *cur_file_name;
  129. X
  130. Xextern int read_mapwin_file;
  131. Xextern int write_mapwin_file;
  132. Xextern char mapwin_file[];
  133. X
  134. X
  135. Xextern int all_layer[MAXLAYRS];
  136. Xextern int numlayers;
  137. X
  138. X/* storage area big enough for inputs */
  139. X#ifndef MAXPATHLEN
  140. X#define MAXPATHLEN 1025
  141. X#endif
  142. Xextern char a_title[];
  143. Xextern char a_starfile[];
  144. Xextern char a_indexfile[];
  145. Xextern char a_planetfile[];
  146. Xextern char a_nebfile[];
  147. Xextern char a_constfile[];
  148. Xextern char a_boundfile[];
  149. Xextern char a_patternfile[];
  150. Xextern char a_cnamefile[];
  151. Xextern char a_userfile[][MAXPATHLEN];
  152. X
  153. X
  154. X#define READ_MAPWIN 1
  155. X#define WRITE_MAPWIN 2
  156. X#define NO_MAPWIN 0
  157. X
  158. X/* starX11 X items */
  159. Xextern Display *display;       /* connection to display server */
  160. Xextern Window root, window;       /* window to graphics in */
  161. Xextern Drawable draw_into;
  162. Xextern Colormap default_cmap;       /* colormap */
  163. Xextern GC default_GC;           /* graphics context */
  164. Xextern XFontStruct *default_font;  /* default font */
  165. Xextern XFontStruct *greek_font;       /* Greek font */
  166. Xextern Pixmap backup;           /* backup for expose events */
  167. Xextern Pixel black, white, foreground, background;
  168. Xextern Pixel *pixels;           /* color map cells */
  169. Xextern Pixel *star_pixels;         /* color map cells for super color stars */
  170. Xextern int ncolors, star_colors;
  171. Xextern XEvent event;           /* event structure */
  172. Xextern XGCValues values_GC;       /* modify GC */
  173. Xextern unsigned int width, height;
  174. X
  175. Xextern Boolean reverse;
  176. X
  177. Xextern Bool use_backup;
  178. Xextern Bool hide_drawing;
  179. Xextern Bool post_preview;
  180. Xextern Bool use_x_dashes;
  181. Xextern Bool is_color;           /* Is it color? */
  182. Xextern Bool is_super_color;       /* Is it many color? */
  183. X
  184. X
  185. X
  186. Xextern Bool edit_mapwins;
  187. X
  188. X
  189. X/* From starXaw */
  190. Xextern Widget interface;
  191. Xextern XtTranslations numbers_oneline, string_oneline;
  192. Xextern Bool fixed_win_coo;
  193. X
  194. X
  195. X/* From starXawDlog */
  196. XWidget Get_float();
  197. XWidget Get_string();
  198. XWidget Get_int();
  199. Xvoid do_dismiss();
  200. Xvoid update_string();
  201. Xextern char *lay_strings[], *filetype_strings[];
  202. X#define MAXLAYNUM 14
  203. X#define MAXFTYPES 6
  204. X
  205. X/* Local */
  206. Xstatic Bool done_mapwin = False;
  207. Xstatic int editting_mapwin = 0;
  208. Xstatic int num_initted_mapwins;    /* Number of mapwins which have 
  209. X                   been initialized */
  210. X
  211. Xstatic char *loc_proj_mode_strings[] = {
  212. X  "Error",
  213. X  "Sansons",
  214. X  "Stereographic",
  215. X  "Gnomonic",
  216. X  "Orthographic",
  217. X  "Rectangular",
  218. X};
  219. X#define MAXPMODE 5
  220. X
  221. X
  222. Xstatic int curr_file;
  223. X
  224. Xstatic char numwin_str[6];
  225. Xstatic Widget numwin_wid;
  226. X/* edit_struct */
  227. Xstatic char width_str[6], height_str[6], x_off_str[6], y_off_str[6];
  228. Xstatic char ra_str[12], de_str[12], sc_str[12];
  229. Xstatic char ra_step_str[12], de_step_str[12], ra_strt_str[12], de_strt_str[12];
  230. X
  231. Xstatic char stru_num_str[80];
  232. Xstatic Widget stru_num_wid, next_map_wid, prev_map_wid;
  233. Xstatic char file_num_str[80];
  234. Xstatic Widget file_num_wid, next_file_wid, prev_file_wid;
  235. Xstatic Widget width_wid, height_wid, x_off_wid, y_off_wid;
  236. Xstatic Widget ra_wid, de_wid, sc_wid;
  237. Xstatic Widget ra_step_wid, de_step_wid, ra_strt_wid, de_strt_wid;
  238. Xstatic Widget fix_win_wid, inv_wid, pmode_wid, draw_ra_wid, draw_dec_wid;
  239. X
  240. Xstatic Widget layers_wid[MAXLAYRS];
  241. Xstatic int laynum[MAXLAYRS];
  242. X
  243. Xstatic char numfiles_str[6];
  244. Xstatic Widget numfiles_wid;
  245. X
  246. Xstatic char f_maglim_str[12], f_lbllim_str[12], f_gklim_str[12];
  247. Xstatic char f_vmin_str[12], f_vmax_str[12];
  248. Xstatic char file_name_str[MAXPATHLEN];
  249. Xstatic Widget file_name_wid, f_type_wid;
  250. Xstatic Widget f_maglim_wid, f_lbllim_wid, f_gklim_wid;
  251. Xstatic Widget f_vmin_wid, f_vmax_wid, f_dmaglbl_wid;
  252. X
  253. X
  254. Xvoid done_in(widget,closure,callData)
  255. X    Widget widget;
  256. X    caddr_t closure;        /* Widget */
  257. X    caddr_t callData;
  258. X{
  259. X  done_mapwin = True;
  260. X
  261. X  XtPopdown((Widget) closure);
  262. X  un_help();
  263. X}
  264. X
  265. Xvoid do_win_dismiss(widget,closure,callData)
  266. X    Widget widget;
  267. X    caddr_t closure;        /* Widget */
  268. X    caddr_t callData;
  269. X{
  270. X  win_apply();
  271. X
  272. X  XtPopdown((Widget) closure);
  273. X/*  un_help();*/
  274. X  mwinin_help();
  275. X}
  276. X
  277. X
  278. Xvoid do_file_dismiss(widget,closure,callData)
  279. X    Widget widget;
  280. X    caddr_t closure;        /* Widget */
  281. X    caddr_t callData;
  282. X{
  283. X  file_apply();
  284. X
  285. X  XtPopdown((Widget) closure);
  286. X/*  un_help();*/
  287. X  estru_help();
  288. X}
  289. X
  290. Xvoid do_lay_dismiss(widget,closure,callData)
  291. X    Widget widget;
  292. X    caddr_t closure;        /* Widget */
  293. X    caddr_t callData;
  294. X{
  295. X
  296. X  XtPopdown((Widget) closure);
  297. X/*  un_help();*/
  298. X  estru_help();
  299. X}
  300. X
  301. X
  302. Xvoid next_map(widget,closure,callData)
  303. X    Widget widget;
  304. X    caddr_t closure;        /* Widget */
  305. X    caddr_t callData;
  306. X{
  307. X  win_apply();
  308. X  
  309. X  editting_mapwin++;
  310. X
  311. X  win_reset(closure);
  312. X/*  XtPopdown((Widget) closure);*/
  313. X}
  314. X
  315. Xvoid prev_map(widget,closure,callData)
  316. X    Widget widget;
  317. X    caddr_t closure;        /* Widget */
  318. X    caddr_t callData;
  319. X{
  320. X  win_apply();
  321. X
  322. X  editting_mapwin--;
  323. X
  324. X  win_reset(closure);
  325. X/*  XtPopdown((Widget) closure);*/
  326. X}
  327. X
  328. Xvoid nothing_map(widget,closure,callData)
  329. X    Widget widget;
  330. X    caddr_t closure;        /* Widget */
  331. X    caddr_t callData;
  332. X{
  333. X}
  334. X
  335. X
  336. Xvoid next_file(widget,closure,callData)
  337. X    Widget widget;
  338. X    caddr_t closure;        /* Widget */
  339. X    caddr_t callData;
  340. X{
  341. X  file_apply();
  342. X  curr_file++;
  343. X  file_reset(closure);
  344. X/*  XtPopdown((Widget) closure);*/
  345. X}
  346. X
  347. Xvoid prev_file(widget,closure,callData)
  348. X    Widget widget;
  349. X    caddr_t closure;        /* Widget */
  350. X    caddr_t callData;
  351. X{
  352. X  file_apply();
  353. X  curr_file--;
  354. X  file_reset(closure);
  355. X/*  XtPopdown((Widget) closure);*/
  356. X}
  357. X
  358. Xvoid nothing_file(widget,closure,callData)
  359. X    Widget widget;
  360. X    caddr_t closure;        /* Widget */
  361. X    caddr_t callData;
  362. X{
  363. X}
  364. X
  365. X
  366. Xvoid fixed_coo_toggle(widget,namestr,callData)
  367. X    Widget widget;
  368. X    caddr_t namestr;
  369. X    caddr_t callData;
  370. X{
  371. X  Arg args[1];
  372. X
  373. X  fixed_win_coo = !fixed_win_coo;
  374. X
  375. X  XtSetArg( args[0], XtNlabel, fixed_win_coo ?
  376. X              "Use these settings":
  377. X              "Allow X to set size");
  378. X  XtSetValues(widget, args, (Cardinal)1);
  379. X}
  380. X
  381. Xvoid invert_win_toggle(widget,namestr,callData)
  382. X    Widget widget;
  383. X    caddr_t namestr;
  384. X    caddr_t callData;
  385. X{
  386. X  Arg args[1];
  387. X
  388. X  mapwin[editting_mapwin]->invert =
  389. X    !mapwin[editting_mapwin]->invert;
  390. X
  391. X  XtSetArg( args[0], XtNlabel, 
  392. X       mapwin[editting_mapwin]->invert?
  393. X       "Inverted": "Normal");
  394. X
  395. X  XtSetValues(widget, args, (Cardinal)1);
  396. X}
  397. X
  398. Xvoid win_pmode_select(widget,namestr,callData)
  399. X    Widget widget;
  400. X    caddr_t namestr;
  401. X    caddr_t callData;
  402. X{
  403. X  Arg args[1];
  404. X  char *cp;
  405. X
  406. X  mapwin[editting_mapwin]->proj_mode++;
  407. X  mapwin[editting_mapwin]->proj_mode %= (MAXPMODE+1);
  408. X  if (mapwin[editting_mapwin]->proj_mode == 0)
  409. X    mapwin[editting_mapwin]->proj_mode = 1;
  410. X
  411. X  cp = loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode];
  412. X  XtSetArg( args[0], XtNlabel, cp);
  413. X
  414. X  XtSetValues(widget, args, (Cardinal)1);
  415. X}
  416. X
  417. Xvoid draw_ra_grid_toggle(widget,namestr,callData)
  418. X    Widget widget;
  419. X    caddr_t namestr;
  420. X    caddr_t callData;
  421. X{
  422. X  Arg args[1];
  423. X
  424. X  mapwin[editting_mapwin]->draw_ragrid = !mapwin[editting_mapwin]->draw_ragrid;
  425. X
  426. X  XtSetArg( args[0], XtNlabel, mapwin[editting_mapwin]->draw_ragrid ?
  427. X       "Show R.A. grid":
  428. X       "No R.A. grid");
  429. X
  430. X  XtSetValues(widget, args, (Cardinal)1);
  431. X}
  432. X
  433. Xvoid draw_dec_grid_toggle(widget,namestr,callData)
  434. X    Widget widget;
  435. X    caddr_t namestr;
  436. X    caddr_t callData;
  437. X{
  438. X  Arg args[1];
  439. X
  440. X  mapwin[editting_mapwin]->draw_decgrid
  441. X    = !mapwin[editting_mapwin]->draw_decgrid;
  442. X
  443. X  XtSetArg( args[0], XtNlabel, mapwin[editting_mapwin]->draw_decgrid ?
  444. X       "Show Dec. grid":
  445. X       "No Dec. grid");
  446. X
  447. X  no_dec_grid = !no_dec_grid;
  448. X
  449. X  XtSetValues(widget, args, (Cardinal)1);
  450. X}
  451. X
  452. Xvoid draw_maglbl_toggle(widget,namestr,callData)
  453. X    Widget widget;
  454. X    caddr_t namestr;
  455. X    caddr_t callData;
  456. X{
  457. X  Arg args[1];
  458. X
  459. X  mapwin[editting_mapwin]->file[curr_file].draw_maglbl = 
  460. X    !mapwin[editting_mapwin]->file[curr_file].draw_maglbl;
  461. X
  462. X  XtSetArg(args[0], XtNlabel,
  463. X       mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
  464. X       "Label stars with their magnitudes      ":
  465. X       "Don't Label stars with their magnitudes");
  466. X
  467. X  XtSetValues(widget, args, (Cardinal)1);
  468. X}
  469. X
  470. X
  471. XD_mapwininput()
  472. X{
  473. X  int i;
  474. X  Widget pshell, pwidg, pform;
  475. X  static Arg shell_args[] = {
  476. X    { XtNwidth, (XtArgVal) 100},
  477. X  };
  478. X  char *dlog_name = "mapwininput";
  479. X  Arg Button_arg[10], Label_arg[10];
  480. X  Cardinal NButton_args, NLabel_args;
  481. X  static XtCallbackRec callback[2];
  482. X  Widget twidge1, twidge2;
  483. X  Widget bottom_widge, dismiss_widge;
  484. X  void edit_structs();
  485. X
  486. X  /* First do final customization of the mapwin */
  487. X  /* This is necessary because fix_mapwin() in starcust.c,
  488. X     and the code in main() is not quite appropriate for undoing things set 
  489. X     interactively */
  490. X  for (i = 0; i < numwins; i++) {
  491. X    if (!all_invert && mapwin[i]->invert) mapwin[i]->invert = FALSE;
  492. X  }
  493. X
  494. X  if (edit_mapwins) {
  495. X    num_initted_mapwins = numwins;
  496. X
  497. X    XtSetArg( Button_arg[0], XtNcallback, callback );
  498. X    NButton_args = 1;
  499. X
  500. X    /* Labels should be left justified, and not have borders */
  501. X    XtSetArg( Label_arg[0], XtNborderWidth, 0);
  502. X    XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  503. X    NLabel_args = 2;
  504. X
  505. X
  506. X    /* Create shell and shell widget */
  507. X    pshell = XtCreatePopupShell(dlog_name,
  508. X                topLevelShellWidgetClass,
  509. X                interface, shell_args, XtNumber(shell_args));
  510. X    pwidg = 
  511. X      XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  512. X
  513. X    /* Create this dialog box */
  514. X    pform = 
  515. X      XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  516. X
  517. X
  518. X    /* Create widgets in the box
  519. X       Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  520. X       or XtNhorizDistance and XtNvertDistance
  521. X       arg[1] sets horizontal position, arg[2] sets vertical
  522. X       Each has a callback if appropriate
  523. X       */
  524. X
  525. X
  526. X    twidge1 = 
  527. X      XtCreateManagedWidget("Edit mapwindow structures",
  528. X                labelWidgetClass, pform,
  529. X                Label_arg, NLabel_args);
  530. X
  531. X    numwin_wid = 
  532. X      twidge2 =
  533. X    Get_int("Number of window structures:",
  534. X        twidge1, pform, numwins, numwin_str, sizeof(numwin_str));
  535. X    twidge1 = twidge2;
  536. X
  537. X    callback[0].callback = edit_structs;
  538. X    callback[0].closure = (caddr_t)pwidg;
  539. X    XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  540. X    XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  541. X    NButton_args = 3;
  542. X    twidge2 = 
  543. X      XtCreateManagedWidget( "edit struct",
  544. X              commandWidgetClass, pform, Button_arg, NButton_args);
  545. X    twidge1 = twidge2;
  546. X
  547. X
  548. X    bottom_widge = twidge1;    /* The bottommost widget so far */
  549. X
  550. X    callback[0].callback = done_in;
  551. X    callback[0].closure = (caddr_t)pwidg;
  552. X    XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  553. X    XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  554. X    NButton_args = 3;
  555. X    dismiss_widge = 
  556. X      XtCreateManagedWidget( "Dismiss",
  557. X              commandWidgetClass, pform, Button_arg, NButton_args);
  558. X
  559. X    /* Save the current values */
  560. X    XtPopup(pwidg, XtGrabNonexclusive);
  561. X    mwinin_help();
  562. X    done_mapwin = FALSE;
  563. X    while (!done_mapwin) {
  564. X      XtNextEvent(&event);
  565. X      XtDispatchEvent(&event);
  566. X    };
  567. X  };
  568. X}
  569. X
  570. X
  571. X/* edit structures */
  572. Xvoid edit_structs(widget,closure,callData)
  573. X    Widget widget;
  574. X    caddr_t closure;        /* Widget */
  575. X    caddr_t callData;
  576. X{
  577. X  Widget pshell, pwidg, pform;
  578. X  static Arg shell_args[] = {
  579. X    { XtNwidth, (XtArgVal) 100},
  580. X  };
  581. X  char *dlog_name = "edit structs";
  582. X  Arg Button_arg[10], Text_arg[10], Label_arg[10];
  583. X  Cardinal NButton_args, NText_args, NLabel_args;
  584. X  static XtCallbackRec callback[2];
  585. X  static XtCallbackRec next_callback[3], prev_callback[3];
  586. X  Widget twidge1, twidge2;
  587. X  Widget bottom_widge, dismiss_widge;
  588. X  int i;
  589. X  char *cp;
  590. X  void edit_layers();
  591. X  void edit_files();
  592. X
  593. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  594. X  NButton_args = 1;
  595. X
  596. X  /* Labels should be left justified, and not have borders */
  597. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  598. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  599. X  NLabel_args = 2;
  600. X
  601. X  pshell = XtCreatePopupShell(dlog_name,
  602. X                  topLevelShellWidgetClass,
  603. X                  widget, shell_args, XtNumber(shell_args));
  604. X  pwidg = 
  605. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  606. X
  607. X  /* Create this dialog box */
  608. X  pform = 
  609. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  610. X
  611. X
  612. X  /* Create widgets in the box
  613. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  614. X     or XtNhorizDistance and XtNvertDistance
  615. X     arg[1] sets horizontal position, arg[2] sets vertical
  616. X     Each has a callback if appropriate
  617. X     */
  618. X
  619. X
  620. X  /* convert numwin_str to numwins */
  621. X  numwins = atoi(numwin_str);
  622. X  if (numwins > MAXWINDOWS) {
  623. X    numwins = MAXWINDOWS;
  624. X    sprintf(numwin_str, "%d", numwins);
  625. X    update_string(numwin_wid, numwin_str);
  626. X  }
  627. X
  628. X  /* Set curr_file to zero for each new mapwindow */
  629. X  curr_file = 0;
  630. X
  631. X
  632. X  /* Create shell and shell widget */
  633. X  if (editting_mapwin >= num_initted_mapwins)
  634. X    init_mapwin(editting_mapwin);
  635. X
  636. X  /* Must make sure that there is a file name */
  637. X  for (i = 0; i < MAXMAPFILES; i++) {
  638. X     if (mapwin[editting_mapwin]->file[i].name == NULL)
  639. X       mapwin[editting_mapwin]->file[i].name = "";
  640. X     if (mapwin[editting_mapwin]->file[i].type == 0)
  641. X       mapwin[editting_mapwin]->file[i].type = LINEREAD;
  642. X   }
  643. X
  644. X  XtSetArg(Text_arg[0], XtNlength, sizeof(stru_num_str));
  645. X  XtSetArg(Text_arg[1], XtNstring, stru_num_str);
  646. X  XtSetArg(Text_arg[2], XtNwidth, 208);
  647. X  XtSetArg(Text_arg[3], XtNborderWidth, 0);
  648. X  NText_args = 4;
  649. X  sprintf(stru_num_str, "Structure number %d", editting_mapwin+1);
  650. X  stru_num_wid =
  651. X    twidge2 = 
  652. X      XtCreateManagedWidget(stru_num_str,
  653. X                asciiStringWidgetClass, pform, 
  654. X                Text_arg, NText_args);
  655. X  twidge1 = twidge2;
  656. X
  657. X
  658. X  width_wid = 
  659. X    twidge2 =
  660. X      Get_int("Width:          ",
  661. X          twidge1, pform,
  662. X          mapwin[editting_mapwin]->width, width_str, sizeof(width_str));
  663. X  twidge1 = twidge2;
  664. X
  665. X  height_wid =
  666. X    twidge2 =
  667. X      Get_int("Height:         ",
  668. X          twidge1, pform,
  669. X          mapwin[editting_mapwin]->height, height_str, sizeof(height_str));
  670. X  twidge1 = twidge2;
  671. X
  672. X  x_off_wid = 
  673. X    twidge2 =
  674. X      Get_int("X offset:       ",
  675. X          twidge1, pform,
  676. X          mapwin[editting_mapwin]->x_offset, x_off_str, sizeof(x_off_str));
  677. X  twidge1 = twidge2;
  678. X
  679. X  y_off_wid = 
  680. X    twidge2 =
  681. X      Get_int("Y offset:       ",
  682. X          twidge1, pform,
  683. X          mapwin[editting_mapwin]->y_offset, y_off_str, sizeof(y_off_str));
  684. X  twidge1 = twidge2;
  685. X
  686. X  /* Fixed window coordinates */
  687. X  callback[0].callback = fixed_coo_toggle;
  688. X  callback[0].closure = (caddr_t) "fixwin";
  689. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  690. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  691. X  XtSetArg(Button_arg[3], XtNwidth, 208);
  692. X  NButton_args = 4;
  693. X
  694. X  fix_win_wid =
  695. X    twidge2 =
  696. X      XtCreateManagedWidget(fixed_win_coo ?
  697. X                "Use these settings":
  698. X                "Allow X to set size",
  699. X              commandWidgetClass, pform, Button_arg, NButton_args);
  700. X
  701. X  twidge1 = twidge2;
  702. X
  703. X
  704. X  /* get RA */
  705. X  ra_wid =
  706. X    twidge2 = Get_float("Right Asc.:     ", twidge1, pform,
  707. X            dtof(mapwin[editting_mapwin]->racen/15.0),
  708. X            ra_str,
  709. X            sizeof(ra_str));
  710. X  twidge1 = twidge2;
  711. X
  712. X  /* get DEC */
  713. X  de_wid =
  714. X    twidge2 = Get_float("Declination:    ", twidge1, pform,
  715. X            dtof(mapwin[editting_mapwin]->dlcen),
  716. X            de_str,
  717. X            sizeof(de_str));
  718. X  twidge1 = twidge2;
  719. X
  720. X  /* Get Scale */
  721. X  sc_wid =
  722. X    twidge2 = Get_float("Scale:          ", twidge1, pform,
  723. X            mapwin[editting_mapwin]->scale,
  724. X            sc_str,
  725. X            sizeof(sc_str));
  726. X  twidge1 = twidge2;
  727. X
  728. X  /* Toggle invert */
  729. X  callback[0].callback = invert_win_toggle;
  730. X  callback[0].closure = (caddr_t) "Invert";
  731. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  732. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  733. X  XtSetArg(Button_arg[3], XtNwidth, 208);
  734. X  NButton_args = 4;
  735. X  inv_wid =
  736. X    twidge2 =
  737. X      XtCreateManagedWidget(mapwin[editting_mapwin]->invert?
  738. X                "Inverted": "Normal",
  739. X              commandWidgetClass, pform, Button_arg, NButton_args);
  740. X
  741. X  twidge1 = twidge2;
  742. X
  743. X  /* Projection mode */
  744. X  callback[0].callback = win_pmode_select;
  745. X  callback[0].closure = (caddr_t) "projection_mode";
  746. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  747. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  748. X
  749. X  cp = loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode];
  750. X
  751. X  pmode_wid =
  752. X    twidge2 =
  753. X      XtCreateManagedWidget(cp,
  754. X              commandWidgetClass, pform, Button_arg, NButton_args);
  755. X  twidge1 = twidge2;
  756. X
  757. X/*  twidge1 = 
  758. X    XtCreateManagedWidget("Specify Grid",
  759. X              labelWidgetClass, pform, 
  760. X              Label_arg, NLabel_args);
  761. X*/
  762. X
  763. X  if (mapwin[editting_mapwin]->ra_step == 0)
  764. X    mapwin[editting_mapwin]->ra_step = 15.0;
  765. X  if (mapwin[editting_mapwin]->dec_step == 0)
  766. X    mapwin[editting_mapwin]->dec_step = 5.0;
  767. X
  768. X  /* Get ra_step */
  769. X  ra_step_wid =
  770. X    twidge2 = Get_float("R.A. Step:      ", twidge1, pform,
  771. X            dtof(mapwin[editting_mapwin]->ra_step/15.0),
  772. X            ra_step_str,
  773. X            sizeof(ra_step_str));
  774. X  twidge1 = twidge2;
  775. X
  776. X  /* Get dec_step */
  777. X  de_step_wid =
  778. X    twidge2 = Get_float("Dec. Step:      ", twidge1, pform,
  779. X            dtof(mapwin[editting_mapwin]->dec_step),
  780. X            de_step_str,
  781. X            sizeof(de_step_str));
  782. X  twidge1 = twidge2;
  783. X
  784. X
  785. X  /* Get ra_strt */
  786. X  ra_strt_wid =
  787. X    twidge2 = Get_float("R.A. Start:     ", twidge1, pform,
  788. X            dtof(mapwin[editting_mapwin]->ra_strt/15.0),
  789. X            ra_strt_str,
  790. X            sizeof(ra_strt_str));
  791. X  twidge1 = twidge2;
  792. X
  793. X  /* Get dec_strt */
  794. X  de_strt_wid =
  795. X    twidge2 = Get_float("Dec. Start:     ", twidge1, pform,
  796. X            dtof(mapwin[editting_mapwin]->dec_strt),
  797. X            de_strt_str,
  798. X            sizeof(de_strt_str));
  799. X  twidge1 = twidge2;
  800. X
  801. X
  802. X  /* Toggle ra */
  803. X  callback[0].callback = draw_ra_grid_toggle;
  804. X  callback[0].closure = (caddr_t) "draw_ra_grid";
  805. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  806. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  807. X  draw_ra_wid =
  808. X    twidge2 =
  809. X      XtCreateManagedWidget(mapwin[editting_mapwin]->draw_ragrid ?
  810. X                "Show R.A. grid":
  811. X                "No R.A. grid",
  812. X              commandWidgetClass, pform, Button_arg, NButton_args);
  813. X  twidge1 = twidge2;
  814. X
  815. X  /* Toggle dec */
  816. X  callback[0].callback = draw_dec_grid_toggle;
  817. X  callback[0].closure = (caddr_t) "draw_dec_grid";
  818. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  819. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  820. X  draw_dec_wid =
  821. X    twidge2 =
  822. X      XtCreateManagedWidget(mapwin[editting_mapwin]->draw_decgrid ?
  823. X                "Show Dec. grid":
  824. X                "No Dec. grid",
  825. X            commandWidgetClass, pform, Button_arg, NButton_args);
  826. X
  827. X  twidge1 = twidge2;
  828. X
  829. X
  830. X
  831. X  callback[0].callback = edit_layers;
  832. X  callback[0].closure = (caddr_t)pwidg;
  833. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  834. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  835. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  836. X  XtSetArg(Button_arg[3], XtNwidth, 208);
  837. X  NButton_args = 4;
  838. X  twidge2 = 
  839. X    XtCreateManagedWidget( "Edit Layers",
  840. X              commandWidgetClass, pform, Button_arg, NButton_args);
  841. X  twidge1 = twidge2;
  842. X
  843. X  numfiles_wid = 
  844. X    twidge2 =
  845. X      Get_int("Number of files:",
  846. X          twidge1, pform, mapwin[editting_mapwin]->numfiles,
  847. X          numfiles_str, sizeof(numfiles_str));
  848. X  twidge1 = twidge2;
  849. X
  850. X  callback[0].callback = edit_files;
  851. X  callback[0].closure = (caddr_t)pwidg;
  852. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  853. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  854. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  855. X  twidge2 = 
  856. X    XtCreateManagedWidget( "Edit Files",
  857. X              commandWidgetClass, pform, Button_arg, NButton_args);
  858. X  twidge1 = twidge2;
  859. X
  860. X
  861. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  862. X
  863. X  if (editting_mapwin < (numwins-1)) {
  864. X    next_callback[0].callback = next_map;
  865. X    next_callback[0].closure = (caddr_t)pwidg;
  866. X/*
  867. X    next_callback[1].callback = edit_structs;
  868. X    next_callback[1].closure = closure;
  869. X*/
  870. X    next_callback[1].callback = NULL;
  871. X    next_callback[1].closure = NULL;
  872. X    cp = "Next";
  873. X  } else {
  874. X    next_callback[0].callback = nothing_map;
  875. X    next_callback[0].closure = (caddr_t)pwidg;
  876. X    next_callback[1].callback = NULL;
  877. X    next_callback[1].closure = NULL;
  878. X    cp = "No Next";
  879. X  }
  880. X  XtSetArg(Button_arg[0], XtNcallback, next_callback);
  881. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  882. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  883. X  XtSetArg(Button_arg[3], XtNwidth, 101);
  884. X  next_map_wid =
  885. X    twidge2 = 
  886. X      XtCreateManagedWidget(cp,
  887. X              commandWidgetClass, pform, Button_arg, NButton_args);
  888. X  twidge1 = twidge2;
  889. X
  890. X
  891. X  if (editting_mapwin > 0) {
  892. X    prev_callback[0].callback = prev_map;
  893. X    prev_callback[0].closure = (caddr_t)pwidg;
  894. X/*
  895. X    prev_callback[1].callback = edit_structs;
  896. X    prev_callback[1].closure = closure;
  897. X*/
  898. X    prev_callback[1].callback = NULL;
  899. X    prev_callback[1].closure = NULL;
  900. X    cp = "Prev";
  901. X  } else {
  902. X    prev_callback[0].callback = nothing_map;
  903. X    prev_callback[0].closure = (caddr_t)pwidg;
  904. X    prev_callback[1].callback = NULL;
  905. X    prev_callback[1].closure = NULL;
  906. X    cp = "No Prev";
  907. X  }
  908. X  XtSetArg(Button_arg[0], XtNcallback, prev_callback);
  909. X  XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
  910. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  911. X  prev_map_wid =
  912. X    twidge2 = 
  913. X      XtCreateManagedWidget( cp,
  914. X              commandWidgetClass, pform, Button_arg, NButton_args);
  915. X  twidge1 = twidge2;
  916. X
  917. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  918. X
  919. X
  920. X  callback[0].callback = do_win_dismiss;
  921. X  callback[0].closure = (caddr_t)pwidg;
  922. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  923. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  924. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  925. X  XtSetArg(Button_arg[3], XtNwidth, 208);
  926. X  dismiss_widge = 
  927. X    XtCreateManagedWidget( "Dismiss",
  928. X            commandWidgetClass, pform, Button_arg, NButton_args);
  929. X
  930. X  XtPopup(pwidg, XtGrabExclusive);
  931. X  estru_help();
  932. X}
  933. X
  934. Xinit_mapwin(win_no)
  935. Xint win_no;
  936. X{
  937. X  int i;
  938. X
  939. X  mapwin[win_no] = (mapwindow *) malloc((unsigned) sizeof(mapwindow));
  940. X  /* Copy the values from mapwin[0] to this mapwin */
  941. X
  942. X  mapwin[win_no]->width = mapwin[0]->width;
  943. X  mapwin[win_no]->height = mapwin[0]->height;
  944. X  mapwin[win_no]->x_offset = mapwin[0]->x_offset;
  945. X  mapwin[win_no]->y_offset = mapwin[0]->y_offset;
  946. X        
  947. X  mapwin[win_no]->maglim = mapwin[0]->maglim;
  948. X  mapwin[win_no]->lbllim = mapwin[0]->lbllim;
  949. X  mapwin[win_no]->gklim = mapwin[0]->gklim;
  950. X
  951. X
  952. X  mapwin[win_no]->map_type = mapwin[0]->map_type;
  953. X  mapwin[win_no]->tag = mapwin[0]->tag;
  954. X  mapwin[win_no]->tag_field = mapwin[0]->tag_field;
  955. X
  956. X  mapwin[win_no]->proj_mode = mapwin[0]->proj_mode;
  957. X  mapwin[win_no]->draw_ragrid = mapwin[0]->draw_ragrid;
  958. X  mapwin[win_no]->draw_decgrid = mapwin[0]->draw_decgrid;
  959. X  mapwin[win_no]->ra_step = mapwin[0]->ra_step;
  960. X  mapwin[win_no]->dec_step = mapwin[0]->dec_step;
  961. X  mapwin[win_no]->ra_strt = mapwin[0]->ra_strt;
  962. X  mapwin[win_no]->dec_strt = mapwin[0]->dec_strt;
  963. X
  964. X  mapwin[win_no]->invert = mapwin[0]->invert;
  965. X
  966. X  mapwin[win_no]->racen = mapwin[0]->racen;
  967. X  mapwin[win_no]->dlcen = mapwin[0]->dlcen;
  968. X  mapwin[win_no]->scale = mapwin[0]->scale;
  969. X
  970. X  mapwin[win_no]->c_scale = mapwin[0]->c_scale;
  971. X   for (i = 0; i < MAXLAYRS; i++)
  972. X     mapwin[win_no]->layer[i] = mapwin[0]->layer[i];
  973. X  mapwin[win_no]->nlayers = mapwin[0]->nlayers;
  974. X
  975. X   for (i = 0; i < MAXMAPFILES; i++) {
  976. X     if (mapwin[0]->file[i].name != NULL)
  977. X       mapwin[win_no]->file[i].name = mapwin[0]->file[i].name;
  978. X     else
  979. X       mapwin[win_no]->file[i].name = "";
  980. X     mapwin[win_no]->file[i].type = mapwin[0]->file[i].type;
  981. X     mapwin[win_no]->file[i].maglim = mapwin[0]->file[i].maglim;
  982. X     mapwin[win_no]->file[i].lbllim = mapwin[0]->file[i].lbllim;
  983. X     mapwin[win_no]->file[i].gklim = mapwin[0]->file[i].gklim;
  984. X
  985. X     mapwin[win_no]->file[i].draw_maglbl = mapwin[0]->file[i].draw_maglbl;
  986. X     mapwin[win_no]->file[i].maglmin = mapwin[0]->file[i].maglmin;
  987. X     mapwin[win_no]->file[i].maglmax = mapwin[0]->file[i].maglmax;
  988. X   }
  989. X
  990. X  mapwin[win_no]->numfiles = mapwin[0]->numfiles;
  991. X
  992. X  num_initted_mapwins = win_no+1;
  993. X}
  994. X
  995. X
  996. X/********** Dialog ***************/
  997. X/* Layers dialog
  998. X   Set mapwin[editting_mapwin].layer
  999. X*/
  1000. X
  1001. Xvoid edit_layers(widget,closure,callData)
  1002. X    Widget widget;
  1003. X    caddr_t closure;        /* Widget */
  1004. X    caddr_t callData;
  1005. X{
  1006. X  Widget pshell, pwidg, pform;
  1007. X  static Arg shell_args[] = {
  1008. X    { XtNwidth, (XtArgVal) 100},
  1009. X  };
  1010. X  char *dlog_name = "layers";
  1011. X  void layer_select();
  1012. X  Arg Button_arg[10], Label_arg[10];
  1013. X  Cardinal NButton_args, NLabel_args;
  1014. X  static XtCallbackRec callback[2];
  1015. X  Widget twidge1, twidge2;
  1016. X  Widget bottom_widge, apply_widge, dismiss_widge;
  1017. X  int i;
  1018. X  char *cp;
  1019. X  void mlayer_select();
  1020. X  void mlayers_apply();
  1021. X
  1022. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  1023. X  NButton_args = 1;
  1024. X
  1025. X  /* Labels should be left justified, and not have borders */
  1026. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  1027. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  1028. X  NLabel_args = 2;
  1029. X
  1030. X
  1031. X  /* Create shell and shell widget */
  1032. X  pshell = XtCreatePopupShell(dlog_name,
  1033. X                  topLevelShellWidgetClass,
  1034. X                  widget, shell_args, XtNumber(shell_args));
  1035. X  pwidg = 
  1036. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  1037. X
  1038. X  /* Create this dialog box */
  1039. X  pform = 
  1040. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  1041. X
  1042. X
  1043. X  /* Create widgets in the box
  1044. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  1045. X     or XtNhorizDistance and XtNvertDistance
  1046. X     arg[1] sets horizontal position, arg[2] sets vertical
  1047. X     Each has a callback if appropriate
  1048. X     */
  1049. X
  1050. X
  1051. X  twidge1 = 
  1052. X    XtCreateManagedWidget("Specify Layer drawing order",
  1053. X              labelWidgetClass, pform, 
  1054. X              Label_arg, NLabel_args);
  1055. X
  1056. X  for (i = 0; i < MAXLAYRS; i++) {
  1057. X    laynum[i] = i;
  1058. X    
  1059. X    callback[0].callback = mlayer_select;
  1060. X    callback[0].closure = (caddr_t) ((int *) &(laynum[i]));
  1061. X    XtSetArg(Button_arg[0], XtNcallback, callback);
  1062. X    XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1063. X    XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  1064. X
  1065. X    NButton_args = 3;
  1066. X    cp = lay_strings[mapwin[editting_mapwin]->layer[i]];
  1067. X    layers_wid[i] = 
  1068. X      twidge2 =
  1069. X    XtCreateManagedWidget(cp,
  1070. X                  commandWidgetClass, pform,
  1071. X                  Button_arg, NButton_args);
  1072. X
  1073. X    twidge1 = twidge2;
  1074. X  }
  1075. X
  1076. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  1077. X
  1078. X
  1079. X  
  1080. X  callback[0].callback = mlayers_apply;
  1081. X  callback[0].closure = (caddr_t)pwidg;
  1082. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1083. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1084. X  NButton_args = 3;
  1085. X  apply_widge = 
  1086. X    XtCreateManagedWidget( " Apply ",
  1087. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1088. X  bottom_widge = apply_widge;
  1089. X
  1090. X  callback[0].callback = do_lay_dismiss;
  1091. X  callback[0].closure = (caddr_t)pwidg;
  1092. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  1093. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1094. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1095. X  dismiss_widge = 
  1096. X    XtCreateManagedWidget( "Dismiss",
  1097. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1098. X
  1099. X  /* Save the current values */
  1100. X  XtPopup(pwidg, XtGrabExclusive);
  1101. X  elay_help();
  1102. X}
  1103. X
  1104. Xvoid mlayer_select(widget, laynump, callData)
  1105. X    Widget widget;
  1106. X    caddr_t laynump;
  1107. X    caddr_t callData;
  1108. X{
  1109. X  Arg args[1];
  1110. X  char *cp;
  1111. X  int i;
  1112. X
  1113. X  i = *((int* ) laynump);
  1114. X
  1115. X  mapwin[editting_mapwin]->layer[i]++;
  1116. X  mapwin[editting_mapwin]->layer[i] %= (MAXLAYNUM+1);
  1117. X
  1118. X  cp = lay_strings[mapwin[editting_mapwin]->layer[i]];
  1119. X  XtSetArg( args[0], XtNlabel, cp);
  1120. X
  1121. X  XtSetValues(widget, args, (Cardinal)1);
  1122. X}
  1123. X
  1124. Xvoid mlayers_apply(widget,closure,callData)
  1125. X    Widget widget;
  1126. X    caddr_t closure;        /* Widget */
  1127. X    caddr_t callData;
  1128. X{
  1129. X  int i, nlayers;
  1130. X  Arg args[1];
  1131. X  char *cp;
  1132. X
  1133. X  for (i = 0, nlayers = 0; i < MAXLAYRS; i++)
  1134. X    if (mapwin[editting_mapwin]->layer[i] != 0)
  1135. X      mapwin[editting_mapwin]->layer[nlayers++]
  1136. X    = mapwin[editting_mapwin]->layer[i];
  1137. X  for (i = nlayers;i < MAXLAYRS; i++) mapwin[editting_mapwin]->layer[i] = 0;
  1138. X  mapwin[editting_mapwin]->nlayers = nlayers;
  1139. X
  1140. X  for (i = 0; i < MAXLAYRS; i++) {
  1141. X    cp = lay_strings[mapwin[editting_mapwin]->layer[i]];
  1142. X    XtSetArg(args[0], XtNlabel, cp);
  1143. X
  1144. X    XtSetValues(layers_wid[i], args, (Cardinal)1);
  1145. X  }
  1146. X}
  1147. X
  1148. Xvoid ftype_win_select(widget, mapnump, callData)
  1149. X    Widget widget;
  1150. X    caddr_t mapnump;
  1151. X    caddr_t callData;
  1152. X{
  1153. X  Arg args[1];
  1154. X  char *cp;
  1155. X
  1156. X  mapwin[editting_mapwin]->file[curr_file].type++;
  1157. X  mapwin[editting_mapwin]->file[curr_file].type %= (MAXFTYPES+1);
  1158. X  if (mapwin[editting_mapwin]->file[curr_file].type == 0)
  1159. X    mapwin[editting_mapwin]->file[curr_file].type = 1;
  1160. X
  1161. X  cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
  1162. X  XtSetArg( args[0], XtNlabel, cp);
  1163. X
  1164. X  XtSetValues(widget, args, (Cardinal)1);
  1165. X}
  1166. X
  1167. X
  1168. X
  1169. X/* edit file structures */
  1170. Xvoid edit_files(widget,closure,callData)
  1171. X    Widget widget;
  1172. X    caddr_t closure;        /* Widget */
  1173. X    caddr_t callData;
  1174. X{
  1175. X  Widget pshell, pwidg, pform;
  1176. X  static Arg shell_args[] = {
  1177. X    { XtNwidth, (XtArgVal) 100},
  1178. X  };
  1179. X  char *dlog_name = "edit files";
  1180. X  Arg Button_arg[10], Text_arg[10], Label_arg[10];
  1181. X  Cardinal NButton_args, NText_args, NLabel_args;
  1182. X  static XtCallbackRec callback[2];
  1183. X  static XtCallbackRec next_callback[3], prev_callback[3];
  1184. X  Widget twidge1, twidge2;
  1185. X  Widget bottom_widge, higher_widge, dismiss_widge;
  1186. X  char *cp;
  1187. X  int i;
  1188. X
  1189. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  1190. X  NButton_args = 1;
  1191. X
  1192. X  /* Labels should be left justified, and not have borders */
  1193. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  1194. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  1195. X  NLabel_args = 2;
  1196. X
  1197. X  /* Create shell and shell widget */
  1198. X  pshell = XtCreatePopupShell(dlog_name,
  1199. X                  topLevelShellWidgetClass,
  1200. X                  widget, shell_args, XtNumber(shell_args));
  1201. X  pwidg = 
  1202. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  1203. X
  1204. X  /* Create this dialog box */
  1205. X  pform = 
  1206. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  1207. X
  1208. X
  1209. X  /* Create widgets in the box
  1210. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  1211. X     or XtNhorizDistance and XtNvertDistance
  1212. X     arg[1] sets horizontal position, arg[2] sets vertical
  1213. X     Each has a callback if appropriate
  1214. X     */
  1215. X
  1216. X
  1217. X  /* convert numfiles_str to numfiles */
  1218. X  i = atoi(numfiles_str);
  1219. X  if (i > MAXMAPFILES) {
  1220. X    i = MAXMAPFILES;
  1221. X    sprintf(numfiles_str, "%d", i);
  1222. X    update_string(numfiles_wid, numfiles_str);
  1223. X  }
  1224. X  mapwin[editting_mapwin]->numfiles = i;
  1225. X
  1226. X
  1227. X  XtSetArg(Text_arg[0], XtNlength, sizeof(file_num_str));
  1228. X  XtSetArg(Text_arg[1], XtNstring, file_num_str);
  1229. X  XtSetArg(Text_arg[2], XtNwidth, 200);
  1230. X  XtSetArg(Text_arg[3], XtNborderWidth, 0);
  1231. X  NText_args = 4;
  1232. X  sprintf(file_num_str, "File number %d", curr_file+1);
  1233. X  file_num_wid =
  1234. X    twidge2 = 
  1235. X      XtCreateManagedWidget(file_num_str,
  1236. X                asciiStringWidgetClass, pform, 
  1237. X                Text_arg, NText_args);
  1238. X
  1239. X  twidge1 = twidge2;
  1240. X
  1241. X  higher_widge = twidge1;
  1242. X  /* File name and type */
  1243. X  strcpy(file_name_str, mapwin[editting_mapwin]->file[curr_file].name);
  1244. X
  1245. X
  1246. X  file_name_wid =
  1247. X    twidge2 = Get_string("File:", twidge1, pform,
  1248. X             file_name_str,
  1249. X             MAXPATHLEN, 300, 300);
  1250. X  twidge1 = twidge2;
  1251. X
  1252. X
  1253. X  XtSetArg(Label_arg[2], XtNfromHoriz, twidge1);
  1254. X  XtSetArg(Label_arg[3], XtNfromVert, higher_widge);
  1255. X  NLabel_args = 4;
  1256. X
  1257. X  twidge2 = 
  1258. X    XtCreateManagedWidget(" Type:",
  1259. X              labelWidgetClass, pform, 
  1260. X              Label_arg, NLabel_args);
  1261. X  twidge1 = twidge2;
  1262. X
  1263. X  callback[0].callback = ftype_win_select;
  1264. X  callback[0].closure = (caddr_t) "fwin";
  1265. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  1266. X  XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
  1267. X  XtSetArg(Button_arg[2], XtNfromVert,  higher_widge);
  1268. X
  1269. X  NButton_args = 3;
  1270. X  cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
  1271. X  f_type_wid =
  1272. X    twidge2 =
  1273. X      XtCreateManagedWidget(cp,
  1274. X                commandWidgetClass, pform,
  1275. X                Button_arg, NButton_args);
  1276. X  twidge1 = twidge2;
  1277. X
  1278. X  /* Magnitudes */
  1279. X  /* Get name limit (lbllim) */
  1280. X  XtSetArg(Label_arg[2], XtNfromVert, twidge1);
  1281. X  NLabel_args = 3;
  1282. X
  1283. X  twidge2 = 
  1284. X    XtCreateManagedWidget("Magnitude limits:",
  1285. X              labelWidgetClass, pform, 
  1286. X              Label_arg, NLabel_args);
  1287. X  twidge1 = twidge2;
  1288. X
  1289. X  f_lbllim_wid =
  1290. X    twidge2 = Get_float("Object names:  ", twidge1, pform,
  1291. X            mapwin[editting_mapwin]->file[curr_file].lbllim,
  1292. X            f_lbllim_str,
  1293. X            sizeof(f_lbllim_str));
  1294. X  twidge1 = twidge2;
  1295. X
  1296. X  /* Get label limit (gklim) */
  1297. X  f_gklim_wid =
  1298. X    twidge2 = Get_float("Bayer labels:  ", twidge1, pform,
  1299. X            mapwin[editting_mapwin]->file[curr_file].gklim,
  1300. X            f_gklim_str,
  1301. X            sizeof(f_gklim_str));
  1302. X  twidge1 = twidge2;
  1303. X
  1304. X  /* Get visibility limit (maglim) */
  1305. X  f_maglim_wid =
  1306. X    twidge2 = Get_float("Object symbol: ", twidge1, pform,
  1307. X            mapwin[editting_mapwin]->file[curr_file].maglim,
  1308. X            f_maglim_str,
  1309. X            sizeof(f_maglim_str));
  1310. X  twidge1 = twidge2;
  1311. X
  1312. X
  1313. X  XtSetArg(Label_arg[2], XtNfromVert, twidge1);
  1314. X  NLabel_args = 3;
  1315. X  twidge2 = 
  1316. X    XtCreateManagedWidget("Star magnitude labeling:",
  1317. X              labelWidgetClass, pform, 
  1318. X              Label_arg, NLabel_args);
  1319. X  twidge1 = twidge2;
  1320. X
  1321. X  f_vmin_wid =
  1322. X    twidge2 = Get_float("Brightest:     ", twidge1, pform,
  1323. X            mapwin[editting_mapwin]->file[curr_file].maglmin,
  1324. X            f_vmin_str,
  1325. X            sizeof(f_vmin_str));
  1326. X  twidge1 = twidge2;
  1327. X
  1328. X  /* Get maximum */
  1329. X  f_vmax_wid =
  1330. X    twidge2 = Get_float("Faintest:      ", twidge1, pform,
  1331. X            mapwin[editting_mapwin]->file[curr_file].maglmax,
  1332. X            f_vmax_str,
  1333. X            sizeof(f_vmax_str));
  1334. X  twidge1 = twidge2;
  1335. X
  1336. X
  1337. X  /* Toggle nomaglabls */
  1338. X  callback[0].callback = draw_maglbl_toggle;
  1339. X  callback[0].closure = (caddr_t) "draw mablbls";
  1340. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1341. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  1342. X  NButton_args = 3;
  1343. X
  1344. X  f_dmaglbl_wid =
  1345. X    twidge2 =
  1346. X      XtCreateManagedWidget(
  1347. X             mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
  1348. X             "Label stars with their magnitudes      ":
  1349. X             "Don't Label stars with their magnitudes",
  1350. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1351. X
  1352. X  twidge1 = twidge2;
  1353. X
  1354. X
  1355. X
  1356. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  1357. X
  1358. X  if (curr_file < (mapwin[editting_mapwin]->numfiles-1)) {
  1359. X    next_callback[0].callback = next_file;
  1360. X    next_callback[0].closure = (caddr_t)pwidg;
  1361. X    next_callback[1].callback = NULL;
  1362. X    next_callback[1].closure = NULL;
  1363. X/*
  1364. X    next_callback[1].callback = edit_files;
  1365. X    next_callback[1].closure = closure;
  1366. X*/
  1367. X    cp = "   Next";
  1368. X  } else {
  1369. X    next_callback[0].callback = nothing_file;
  1370. X    next_callback[0].closure = (caddr_t)pwidg;
  1371. X    next_callback[1].callback = NULL;
  1372. X    next_callback[1].closure = NULL;
  1373. X    cp = "No Next";
  1374. X  }
  1375. X  XtSetArg(Button_arg[0], XtNcallback, next_callback);
  1376. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1377. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  1378. X  NButton_args = 3;
  1379. X  next_file_wid =
  1380. X    twidge2 = 
  1381. X      XtCreateManagedWidget(cp,
  1382. X              commandWidgetClass, pform, Button_arg, NButton_args);
  1383. X  twidge1 = twidge2;
  1384. X
  1385. X
  1386. X  if (curr_file > 0) {
  1387. X    prev_callback[0].callback = prev_file;
  1388. X    prev_callback[0].closure = (caddr_t)pwidg;
  1389. X    prev_callback[1].callback = NULL;
  1390. X    prev_callback[1].closure = NULL;
  1391. X/*
  1392. X    prev_callback[1].callback = edit_files;
  1393. X    prev_callback[1].closure = closure;
  1394. X*/
  1395. X    cp = "   Prev";
  1396. X  } else {
  1397. X    prev_callback[0].callback = nothing_map;
  1398. X    prev_callback[0].closure = (caddr_t)pwidg;
  1399. X    prev_callback[1].callback = NULL;
  1400. X    prev_callback[1].closure = NULL;
  1401. X    cp = "No Prev";
  1402. X  }
  1403. X  XtSetArg(Button_arg[0], XtNcallback, prev_callback);
  1404. X  XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
  1405. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  1406. X  NButton_args = 3;
  1407. X  prev_file_wid =
  1408. X    twidge2 = 
  1409. X      XtCreateManagedWidget( cp,
  1410. X              commandWidgetClass, pform, Button_arg, NButton_args);
  1411. X  twidge1 = twidge2;
  1412. X
  1413. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  1414. X
  1415. X
  1416. X  callback[0].callback = do_file_dismiss;
  1417. X  callback[0].closure = (caddr_t)pwidg;
  1418. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  1419. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1420. X  XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
  1421. X  NButton_args = 3;
  1422. X  dismiss_widge = 
  1423. X    XtCreateManagedWidget( "Dismiss",
  1424. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1425. X
  1426. X  XtPopup(pwidg, XtGrabExclusive);
  1427. X  efiles_help();
  1428. X}
  1429. X
  1430. Xfile_apply()
  1431. X{
  1432. X  char *cp;
  1433. X
  1434. X  if (strcmp(file_name_str, mapwin[editting_mapwin]->file[curr_file].name))
  1435. X    if (cp = (char *) malloc(strlen(file_name_str))) {
  1436. X      mapwin[editting_mapwin]->file[curr_file].name = cp;
  1437. X      strcpy(cp, file_name_str);
  1438. X    }
  1439. X  mapwin[editting_mapwin]->file[curr_file].maglim = atof(f_maglim_str);
  1440. X  mapwin[editting_mapwin]->file[curr_file].lbllim = atof(f_lbllim_str);
  1441. X  mapwin[editting_mapwin]->file[curr_file].gklim = atof(f_gklim_str);
  1442. X  mapwin[editting_mapwin]->file[curr_file].maglmin = atof(f_vmin_str);
  1443. X  mapwin[editting_mapwin]->file[curr_file].maglmax = atof(f_vmax_str);
  1444. X}
  1445. X
  1446. X
  1447. X
  1448. Xwin_apply()
  1449. X{
  1450. X
  1451. X  mapwin[editting_mapwin]->width = atoi(width_str);
  1452. X  mapwin[editting_mapwin]->height = atoi(height_str);
  1453. X  mapwin[editting_mapwin]->x_offset = atoi(x_off_str);
  1454. X  mapwin[editting_mapwin]->y_offset = atoi(y_off_str);
  1455. X  mapwin[editting_mapwin]->racen = htod(ra_str)*15.0;
  1456. X  mapwin[editting_mapwin]->dlcen = htod(de_str);
  1457. X  mapwin[editting_mapwin]->scale = atof(sc_str);
  1458. X
  1459. X  mapwin[editting_mapwin]->ra_step = htod(ra_step_str)*15.0;
  1460. X  mapwin[editting_mapwin]->dec_step = htod(de_step_str);
  1461. X  mapwin[editting_mapwin]->ra_strt = htod(ra_strt_str)*15.0;
  1462. X  mapwin[editting_mapwin]->dec_strt = htod(de_strt_str);
  1463. X}
  1464. X
  1465. X
  1466. X/* win_reset must do everything edit_structs does on entry */
  1467. Xwin_reset(closure)
  1468. X    caddr_t closure;        /* Widget */
  1469. X{
  1470. X  Arg Label_arg[10];
  1471. X  int i;
  1472. X  char *cp;
  1473. X  static XtCallbackRec next_callback[3], prev_callback[3];
  1474. X
  1475. X  /* convert numwin_str to numwins */
  1476. X  numwins = atoi(numwin_str);
  1477. X  if (numwins > MAXWINDOWS) {
  1478. X    numwins = MAXWINDOWS;
  1479. X    sprintf(numwin_str, "%d", numwins);
  1480. X    update_string(numwin_wid, numwin_str);
  1481. X  }
  1482. X
  1483. X  /* Set curr_file to zero for each new mapwindow */
  1484. X  curr_file = 0;
  1485. X
  1486. X
  1487. X  /* Create shell and shell widget */
  1488. X  if (editting_mapwin >= num_initted_mapwins)
  1489. X    init_mapwin(editting_mapwin);
  1490. X
  1491. X  /* Must make sure that there is a file name */
  1492. X  for (i = 0; i < MAXMAPFILES; i++) {
  1493. X     if (mapwin[editting_mapwin]->file[i].name == NULL)
  1494. X       mapwin[editting_mapwin]->file[i].name = "";
  1495. X     if (mapwin[editting_mapwin]->file[i].type == 0)
  1496. X       mapwin[editting_mapwin]->file[i].type = LINEREAD;
  1497. X   }
  1498. X
  1499. X  sprintf(stru_num_str, "Structure number %d", editting_mapwin+1);
  1500. X  XtSetArg(Label_arg[0], XtNlabel, stru_num_str);
  1501. X  XtSetValues(stru_num_wid, Label_arg, (Cardinal)1);
  1502. X  XtTextSetLastPos(stru_num_wid, strlen(stru_num_str));
  1503. X
  1504. X  if (editting_mapwin < (numwins-1)) {
  1505. X    next_callback[0].callback = next_map;
  1506. X    next_callback[0].closure = closure;
  1507. X    next_callback[1].callback = NULL;
  1508. X    next_callback[1].closure = NULL;
  1509. X    cp = "Next";
  1510. X  } else {
  1511. X    next_callback[0].callback = nothing_map;
  1512. X    next_callback[0].closure = closure;
  1513. X    next_callback[1].callback = NULL;
  1514. X    next_callback[1].closure = NULL;
  1515. X    cp = "No Next";
  1516. X  }
  1517. X  XtSetArg(Label_arg[0], XtNcallback, next_callback);
  1518. X  XtSetArg(Label_arg[1], XtNlabel, cp);
  1519. X  XtSetValues(next_map_wid, Label_arg, (Cardinal)2);
  1520. X
  1521. X
  1522. X  if (editting_mapwin > 0) {
  1523. X    prev_callback[0].callback = prev_map;
  1524. X    prev_callback[0].closure = closure;
  1525. X    prev_callback[1].callback = NULL;
  1526. X    prev_callback[1].closure = NULL;
  1527. X    cp = "Prev";
  1528. X  } else {
  1529. X    prev_callback[0].callback = nothing_map;
  1530. X    prev_callback[0].closure = closure;
  1531. X    prev_callback[1].callback = NULL;
  1532. X    prev_callback[1].closure = NULL;
  1533. X    cp = "No Prev";
  1534. X  }
  1535. X  XtSetArg(Label_arg[0], XtNcallback, prev_callback);
  1536. X  XtSetArg(Label_arg[1], XtNlabel, cp);
  1537. X  XtSetValues(prev_map_wid, Label_arg, (Cardinal)2);
  1538. X
  1539. X
  1540. X
  1541. X  sprintf(width_str,"%d", mapwin[editting_mapwin]->width);
  1542. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1543. X  XtSetValues(width_wid, Label_arg, (Cardinal)1);
  1544. X  XtTextSetLastPos(width_wid, strlen(width_str));
  1545. X
  1546. X  sprintf(height_str,"%d", mapwin[editting_mapwin]->height);
  1547. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1548. X  XtSetValues(height_wid, Label_arg, (Cardinal)1);
  1549. X  XtTextSetLastPos(height_wid, strlen(height_str));
  1550. X
  1551. X  sprintf(x_off_str,"%d", mapwin[editting_mapwin]->x_offset);
  1552. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1553. X  XtSetValues(x_off_wid, Label_arg, (Cardinal)1);
  1554. X  XtTextSetLastPos(x_off_wid, strlen(x_off_str));
  1555. X
  1556. X  sprintf(y_off_str,"%d", mapwin[editting_mapwin]->y_offset);
  1557. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1558. X  XtSetValues(y_off_wid, Label_arg, (Cardinal)1);
  1559. X  XtTextSetLastPos(y_off_wid, strlen(y_off_str));
  1560. X
  1561. X  XtSetArg(Label_arg[0], XtNlabel, fixed_win_coo ?
  1562. X       "Use these settings":
  1563. X       "Allow X to set size");
  1564. X  XtSetValues(fix_win_wid, Label_arg, (Cardinal)1);
  1565. X
  1566. X  sprintf(ra_str, "%.4f", dtof(mapwin[editting_mapwin]->racen/15.0));
  1567. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1568. X  XtSetValues(ra_wid, Label_arg, (Cardinal)1);
  1569. X  XtTextSetLastPos(ra_wid, strlen(ra_str));
  1570. X
  1571. X  sprintf(de_str, "%.4f", dtof(mapwin[editting_mapwin]->dlcen));
  1572. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1573. X  XtSetValues(de_wid, Label_arg, (Cardinal)1);
  1574. X  XtTextSetLastPos(de_wid, strlen(de_str));
  1575. X
  1576. X  sprintf(sc_str, "%.4f", mapwin[editting_mapwin]->scale);
  1577. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1578. X  XtSetValues(sc_wid, Label_arg, (Cardinal)1);
  1579. X  XtTextSetLastPos(sc_wid, strlen(sc_str));
  1580. X
  1581. X
  1582. X  XtSetArg(Label_arg[0], XtNlabel,mapwin[editting_mapwin]->invert?
  1583. X                "Inverted": "Normal");
  1584. X  XtSetValues(inv_wid, Label_arg, (Cardinal)1);
  1585. X
  1586. X  XtSetArg(Label_arg[0], XtNlabel,
  1587. X       loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode]);
  1588. X  XtSetValues(pmode_wid, Label_arg, (Cardinal)1);
  1589. X
  1590. X  sprintf(ra_step_str, "%.4f", dtof(mapwin[editting_mapwin]->ra_step/15.0));
  1591. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1592. X  XtSetValues(ra_step_wid, Label_arg, (Cardinal)1);
  1593. X  XtTextSetLastPos(ra_step_wid, strlen(ra_step_str));
  1594. X
  1595. X  sprintf(de_step_str, "%.4f", dtof(mapwin[editting_mapwin]->dec_step));
  1596. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1597. X  XtSetValues(de_step_wid, Label_arg, (Cardinal)1);
  1598. X  XtTextSetLastPos(de_step_wid, strlen(de_step_str));
  1599. X
  1600. X  sprintf(ra_strt_str, "%.4f", dtof(mapwin[editting_mapwin]->ra_strt/15.0));
  1601. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1602. X  XtSetValues(ra_strt_wid, Label_arg, (Cardinal)1);
  1603. X  XtTextSetLastPos(ra_strt_wid, strlen(ra_strt_str));
  1604. X
  1605. X  sprintf(de_strt_str, "%.4f", dtof(mapwin[editting_mapwin]->dec_strt));
  1606. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1607. X  XtSetValues(de_strt_wid, Label_arg, (Cardinal)1);
  1608. X  XtTextSetLastPos(de_strt_wid, strlen(de_strt_str));
  1609. X
  1610. X
  1611. X  XtSetArg(Label_arg[0], XtNlabel, mapwin[editting_mapwin]->draw_ragrid ?
  1612. X                "Show R.A. grid":
  1613. X                "No R.A. grid");
  1614. X  XtSetValues(draw_ra_wid, Label_arg, (Cardinal)1);
  1615. X
  1616. X  XtSetArg(Label_arg[0], XtNlabel, mapwin[editting_mapwin]->draw_decgrid ?
  1617. X                "Show Dec. grid":
  1618. X                "No Dec. grid");
  1619. X  XtSetValues(draw_dec_wid, Label_arg, (Cardinal)1);
  1620. X
  1621. X
  1622. X  sprintf(numfiles_str,"%d", mapwin[editting_mapwin]->numfiles);
  1623. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1624. X  XtSetValues(numfiles_wid, Label_arg, (Cardinal)1);
  1625. X  XtTextSetLastPos(numfiles_wid, strlen(numfiles_str));
  1626. X}
  1627. X
  1628. X
  1629. X
  1630. Xfile_reset(closure)
  1631. X    caddr_t closure;        /* Widget */
  1632. X{
  1633. X  Arg Label_arg[10];
  1634. X  int i;
  1635. X  char *cp;
  1636. X  static XtCallbackRec next_callback[3], prev_callback[3];
  1637. X
  1638. X
  1639. X  /* convert numfiles_str to numfiles */
  1640. X  i = atoi(numfiles_str);
  1641. X  if (i > MAXMAPFILES) {
  1642. X    i = MAXMAPFILES;
  1643. X    sprintf(numfiles_str, "%d", i);
  1644. X    update_string(numfiles_wid, numfiles_str);
  1645. X  }
  1646. X  mapwin[editting_mapwin]->numfiles = i;
  1647. X
  1648. X
  1649. X  sprintf(file_num_str, "File number %d", curr_file+1);
  1650. X  XtSetArg(Label_arg[0], XtNlabel, file_num_str);
  1651. X  XtSetValues(file_num_wid, Label_arg, (Cardinal)1);
  1652. X  XtTextSetLastPos(file_num_wid, strlen(file_num_str));
  1653. X
  1654. X  if (curr_file < (mapwin[editting_mapwin]->numfiles-1)) {
  1655. X    next_callback[0].callback = next_file;
  1656. X    next_callback[0].closure = closure;
  1657. X    next_callback[1].callback = NULL;
  1658. X    next_callback[1].closure = NULL;
  1659. X    cp = "   Next";
  1660. X  } else {
  1661. X    next_callback[0].callback = nothing_file;
  1662. X    next_callback[0].closure = closure;
  1663. X    next_callback[1].callback = NULL;
  1664. X    next_callback[1].closure = NULL;
  1665. X    cp = "No Next";
  1666. X  }
  1667. X  XtSetArg(Label_arg[0], XtNcallback, next_callback);
  1668. X  XtSetArg(Label_arg[1], XtNlabel, cp);
  1669. X  XtSetValues(next_file_wid, Label_arg, (Cardinal)2);
  1670. X
  1671. X
  1672. X  if (curr_file > 0) {
  1673. X    prev_callback[0].callback = prev_file;
  1674. X    prev_callback[0].closure = closure;
  1675. X    prev_callback[1].callback = NULL;
  1676. X    prev_callback[1].closure = NULL;
  1677. X    cp = "   Prev";
  1678. X  } else {
  1679. X    prev_callback[0].callback = nothing_file;
  1680. X    prev_callback[0].closure = closure;
  1681. X    prev_callback[1].callback = NULL;
  1682. X    prev_callback[1].closure = NULL;
  1683. X    cp = "No Prev";
  1684. X  }
  1685. X  XtSetArg(Label_arg[0], XtNcallback, prev_callback);
  1686. X  XtSetArg(Label_arg[1], XtNlabel, cp);
  1687. X  XtSetValues(prev_file_wid, Label_arg, (Cardinal)2);
  1688. X
  1689. X  /* file name string */
  1690. X  strcpy(file_name_str, mapwin[editting_mapwin]->file[curr_file].name);
  1691. X  update_string(file_name_wid, file_name_str);
  1692. X  
  1693. X  /* file type toggle */
  1694. X  cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
  1695. X  XtSetArg(Label_arg[0], XtNlabel, cp);
  1696. X  XtSetValues(f_type_wid, Label_arg, (Cardinal)1);
  1697. X
  1698. X  /* mags (floats) */ 
  1699. X  sprintf(f_lbllim_str, "%.4f",
  1700. X      mapwin[editting_mapwin]->file[curr_file].lbllim);
  1701. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1702. X  XtSetValues(f_lbllim_wid, Label_arg, (Cardinal)1);
  1703. X  XtTextSetLastPos(f_lbllim_wid, strlen(f_lbllim_str));
  1704. X
  1705. X  sprintf(f_gklim_str, "%.4f",
  1706. X      mapwin[editting_mapwin]->file[curr_file].gklim);
  1707. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1708. X  XtSetValues(f_gklim_wid, Label_arg, (Cardinal)1);
  1709. X  XtTextSetLastPos(f_gklim_wid, strlen(f_gklim_str));
  1710. X
  1711. X  sprintf(f_maglim_str, "%.4f",
  1712. X      mapwin[editting_mapwin]->file[curr_file].maglim);
  1713. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1714. X  XtSetValues(f_maglim_wid, Label_arg, (Cardinal)1);
  1715. X  XtTextSetLastPos(f_maglim_wid, strlen(f_maglim_str));
  1716. X
  1717. X  /* min and max */
  1718. X  sprintf(f_vmin_str, "%.4f",
  1719. X      mapwin[editting_mapwin]->file[curr_file].maglmin);
  1720. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1721. X  XtSetValues(f_vmin_wid, Label_arg, (Cardinal)1);
  1722. X  XtTextSetLastPos(f_vmin_wid, strlen(f_vmin_str));
  1723. X
  1724. X  sprintf(f_vmax_str, "%.4f",
  1725. X      mapwin[editting_mapwin]->file[curr_file].maglmax);
  1726. X  XtSetArg(Label_arg[0], XtNinsertPosition, 0);
  1727. X  XtSetValues(f_vmax_wid, Label_arg, (Cardinal)1);
  1728. X  XtTextSetLastPos(f_vmax_wid, strlen(f_vmax_str));
  1729. X
  1730. X  /* labl toggle */
  1731. X  XtSetArg(Label_arg[0], XtNlabel,
  1732. X       mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
  1733. X       "Label stars with their magnitudes      ":
  1734. X       "Don't Label stars with their magnitudes");
  1735. X  XtSetValues(f_dmaglbl_wid, Label_arg, (Cardinal)1);
  1736. X}
  1737. END_OF_FILE
  1738. if test 47939 -ne `wc -c <'starchart/starXawMwin.c'`; then
  1739.     echo shar: \"'starchart/starXawMwin.c'\" unpacked with wrong size!
  1740. fi
  1741. # end of 'starchart/starXawMwin.c'
  1742. fi
  1743. echo shar: End of archive 32 \(of 32\).
  1744. cp /dev/null ark32isdone
  1745. MISSING=""
  1746. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
  1747.     if test ! -f ark${I}isdone ; then
  1748.     MISSING="${MISSING} ${I}"
  1749.     fi
  1750. done
  1751. if test "${MISSING}" = "" ; then
  1752.     echo You have unpacked all 32 archives.
  1753.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1754.     cat doc/as.texi.a? > doc/astro.texinfo
  1755.     echo "Please rm doc/as.texi.a{a,b}"
  1756.     cat doc/as.ms.a? > doc/astro.ms
  1757.     echo "Please rm doc/as.ms.a{a,b}"
  1758.     cat starchart/sXawD.c.a? > starchart/starXawDlog.c
  1759.     echo "Please rm starchart/sXawD.c.a{a,b}"
  1760.     cat starchart/spo.c.a? > starchart/starpost.c
  1761.     echo "Please rm starchart/spo.c.a{a,b}"
  1762.     cat starchart/ssup.c.a? > starchart/starsupp.c
  1763.     echo "Please rm starchart/ssup.c.a{a,b}"
  1764. else
  1765.     echo You still need to unpack the following archives:
  1766.     echo "        " ${MISSING}
  1767. fi
  1768. ##  End of shell archive.
  1769. exit 0
  1770.  
  1771.