home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / star.lzh / star.32 < prev    next >
Encoding:
Text File  |  1990-04-06  |  50.3 KB  |  1,764 lines

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