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

  1. Newsgroups: comp.sources.misc
  2. subject: v11i048: starchart 3.2 Part 20/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 48
  7. Submitted-by: ccount@ATHENA.MIT.EDU
  8. Archive-name: starchart/part20
  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 20 (of 32)."
  17. # Contents:  starchart/sXawD.c.aa
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f 'starchart/sXawD.c.aa' -a "${1}" != "-c" ; then 
  20.   echo shar: Will not clobber existing file \"'starchart/sXawD.c.aa'\"
  21. else
  22. echo shar: Extracting \"'starchart/sXawD.c.aa'\" \(31360 characters\)
  23. sed "s/^X//" >'starchart/sXawD.c.aa' <<'END_OF_FILE'
  24. X/*
  25. X * Dialogs for starXaw
  26. X * Rewritten from scratch July 1989
  27. X *
  28. X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
  29. X *
  30. X * This software may be redistributed freely, not sold.
  31. X * This copyright notice and disclaimer of warranty must remain
  32. X *    unchanged. 
  33. X *
  34. X * No representation is made about the suitability of this
  35. X * software for any purpose.  It is provided "as is" without express or
  36. X * implied warranty, to the extent permitted by applicable law.
  37. X *
  38. X */
  39. X
  40. Xstatic char rcsid[]="$Header: starXawDlog.c,v 1.10 90/03/10 15:33:47 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. X#include "starXawDlog.h"
  73. X
  74. Xchar *malloc();
  75. X
  76. X#define LINELEN 82
  77. X
  78. X#define MAX(a,b) ((a)>(b)?(a):(b))
  79. X#define MIN(a,b) ((a)<(b)?(a):(b))
  80. X
  81. Xextern char *prog;
  82. X
  83. X/* Externs */
  84. Xextern int g_argc;
  85. Xextern char **g_argv;
  86. X
  87. Xextern char *title;
  88. X
  89. X/* From starchart.c */
  90. Xextern double ra, de, sc;
  91. Xextern double all_lbllim, all_maglim, all_gklim;
  92. Xextern int use_lbllim, use_maglim, use_gklim;
  93. X
  94. Xextern int precess;
  95. Xextern double to_precess;
  96. X
  97. Xextern double all_vmin, all_vmax;
  98. Xextern int use_vmin;
  99. Xextern int nomaglbls;
  100. X
  101. Xextern double all_rstep, all_dstep;
  102. Xextern int use_rstep;
  103. Xextern double all_rstrt, all_dstrt;
  104. Xextern int no_ra_grid;
  105. Xextern int no_dec_grid;
  106. X
  107. Xextern int all_invert;
  108. X
  109. Xextern int chart_type;
  110. X
  111. Xextern int all_proj_mode;
  112. X
  113. Xextern char *rcfile;
  114. X
  115. Xextern char *constfile;
  116. Xextern char *boundfile;
  117. Xextern char boundftype;
  118. Xextern char *patternfile;
  119. Xextern char pattftype;
  120. Xextern char *cnamefile;
  121. Xextern char cnameftype;
  122. Xextern char *mapfiles[];
  123. Xextern int mapftypes[];
  124. Xextern int nummapfiles;
  125. X
  126. Xextern mapwindow *mapwin[];
  127. Xextern int numwins;
  128. X
  129. Xextern int cur_function;
  130. Xextern int cur_map_type;
  131. Xextern int cur_map_tag;
  132. Xextern char *cur_tag_field;
  133. Xextern char *cur_file_name;
  134. X
  135. Xextern int read_mapwin_file;
  136. Xextern int write_mapwin_file;
  137. Xextern char mapwin_file[];
  138. X
  139. X
  140. Xextern int all_layer[MAXLAYRS];
  141. Xextern int numlayers;
  142. X
  143. X/* storage area big enough for inputs */
  144. X#ifndef MAXPATHLEN
  145. X#define MAXPATHLEN 1025
  146. X#endif
  147. Xextern char a_title[];
  148. Xextern char a_starfile[];
  149. Xextern char a_indexfile[];
  150. Xextern char a_planetfile[];
  151. Xextern char a_nebfile[];
  152. Xextern char a_constfile[];
  153. Xextern char a_boundfile[];
  154. Xextern char a_patternfile[];
  155. Xextern char a_cnamefile[];
  156. Xextern char a_userfile[][MAXPATHLEN];
  157. X
  158. X/* local similar buffers */
  159. Xchar a_constname[MAXPATHLEN];
  160. Xchar a_rcfile[MAXPATHLEN];
  161. Xchar write_rcfile[MAXPATHLEN];
  162. X
  163. X#define READ_MAPWIN 1
  164. X#define WRITE_MAPWIN 2
  165. X#define NO_MAPWIN 0
  166. Xint save_load_state;
  167. Xchar *save_load_str[] = {
  168. X  "   No mapwin file",
  169. X  " Read mapwin file",
  170. X  "Write mapwin file"
  171. X};
  172. X
  173. X/* Shared with starXawMwin.c */
  174. XBool edit_mapwins = False;
  175. X
  176. X/* starX11 X items */
  177. Xextern Display *display;       /* connection to display server */
  178. Xextern Window root, window;       /* window to graphics in */
  179. Xextern Drawable draw_into;
  180. Xextern Colormap default_cmap;       /* colormap */
  181. Xextern GC default_GC;           /* graphics context */
  182. Xextern XFontStruct *default_font;  /* default font */
  183. Xextern XFontStruct *greek_font;       /* Greek font */
  184. Xextern Pixmap backup;           /* backup for expose events */
  185. Xextern Pixel black, white, foreground, background;
  186. Xextern Pixel *pixels;           /* color map cells */
  187. Xextern Pixel *star_pixels;         /* color map cells for super color stars */
  188. Xextern int ncolors, star_colors;
  189. Xextern XEvent event;           /* event structure */
  190. Xextern XGCValues values_GC;       /* modify GC */
  191. Xextern unsigned int width, height;
  192. X
  193. Xextern Boolean reverse;
  194. X
  195. Xextern Bool use_backup;
  196. Xextern Bool hide_drawing;
  197. Xextern Bool post_preview;
  198. Xextern Bool post_landscape;
  199. Xextern Bool use_x_dashes;
  200. Xextern Bool is_color;           /* Is it color? */
  201. Xextern Bool is_super_color;       /* Is it many color? */
  202. X
  203. X/* From starXaw */
  204. Xextern Bool fixed_size;
  205. Xextern int fixed_width;
  206. Xextern int fixed_height;
  207. X
  208. X
  209. Xint pp_status;
  210. X
  211. Xvoid Chart(), Type(), Magnitudes(), Layers(), Map_files(),
  212. X  Projection_mode(), Magnitude_labels(), Grid(), Edit_mapwins(), X_parms();
  213. X
  214. XButton_set dlogbuttons[] = {
  215. X  {"Chart", Chart},
  216. X  {"Type", Type},
  217. X  {"Magnitudes", Magnitudes},
  218. X  {"Layers", Layers},
  219. X  {"Data Files", Map_files},
  220. X  {"Projection Mode", Projection_mode},
  221. X  {"Magnitude Labels", Magnitude_labels},
  222. X  {"Grid", Grid},
  223. X  {"Additional Control", Edit_mapwins},
  224. X  {"X Parameters", X_parms},
  225. X  {"", NULL},
  226. X};
  227. X
  228. X
  229. X/****/
  230. X/* The dialog boxes */
  231. X/* There must be a better way, but for now, use this variable to indicate
  232. X   which dialog is being cancelled */
  233. XDlogType current_dialog = NoDialog;
  234. X
  235. XChartD_S ChartD;
  236. XTypeD_S TypeD;
  237. XMagnitudesD_S MagnitudesD;
  238. XLayersD_S LayersD;
  239. XMap_filesD_S Map_filesD;
  240. XProjection_modeD_S Projection_modeD;
  241. XMagnitude_labelsD_S Magnitude_labelsD;
  242. XGridD_S GridD;
  243. XEdit_mapwinsD_S Edit_mapwinsD;
  244. XX_parmsD_S X_parmsD;
  245. X
  246. X
  247. X
  248. X
  249. X/* It's OK */
  250. Xvoid do_dismiss(widget,closure,callData)
  251. X    Widget widget;
  252. X    caddr_t closure;        /* Widget */
  253. X    caddr_t callData;
  254. X{
  255. X  un_help();
  256. X  XtPopdown((Widget) closure);
  257. X}
  258. X
  259. X/* It's not OK */
  260. Xvoid do_cancel(widget,closure,callData)
  261. X    Widget widget;
  262. X    caddr_t closure;
  263. X    caddr_t callData;
  264. X{
  265. X  int i;
  266. X
  267. X  switch (current_dialog) {
  268. X  case ChartDialog:
  269. X    fprintf(stderr,"Cancelling the chart dialog\n");
  270. X    ra = ChartD.ra;
  271. X    de = ChartD.de;
  272. X    sc = ChartD.sc;
  273. X    title = ChartD.title;
  274. X    constfile = ChartD.constfile;
  275. X    all_invert = ChartD.all_invert;
  276. X    precess = ChartD.precess;
  277. X    to_precess = ChartD.to_precess;
  278. X    break;
  279. X  case TypeDialog:
  280. X    fprintf(stderr,"Cancelling the type dialog\n");
  281. X    chart_type = TypeD.chart_type;
  282. X    break;
  283. X  case MagnitudesDialog:
  284. X    fprintf(stderr,"Cancelling the magnitudes dialog\n");
  285. X    all_lbllim = MagnitudesD.all_lbllim;
  286. X    all_maglim = MagnitudesD.all_maglim;
  287. X    all_gklim = MagnitudesD.all_gklim;
  288. X    break;
  289. X  case LayersDialog:
  290. X    fprintf(stderr,"Cancelling the layers dialog\n");
  291. X    for (i = 0; i < MAXLAYRS; i++)
  292. X      all_layer[i] = LayersD.all_layer[i];
  293. X    numlayers = LayersD.numlayers;
  294. X    break;
  295. X  case Map_filesDialog:
  296. X    fprintf(stderr,"Cancelling the files dialog\n");
  297. X    for (i = 0; i < MAXMAPFILES; i++) {
  298. X      strcpy(mapfiles[i], Map_filesD.mapfiles[i]);
  299. X      mapftypes[i] = Map_filesD.mapftypes[i];
  300. X    }
  301. X    nummapfiles = Map_filesD.nummapfiles;
  302. X    break;
  303. X  case Projection_modeDialog:
  304. X    fprintf(stderr,"Cancelling the projection mode dialog\n");
  305. X    all_proj_mode = Projection_modeD.all_proj_mode;
  306. X    break;
  307. X  case Magnitude_labelsDialog:
  308. X    fprintf(stderr,"Cancelling the magnitude labels dialog\n");
  309. X    all_vmin = Magnitude_labelsD.all_vmin;
  310. X    all_vmax = Magnitude_labelsD.all_vmax;
  311. X    break;
  312. X  case GridDialog:
  313. X    fprintf(stderr,"Cancelling the grid dialog\n");
  314. X    all_rstep = GridD.all_rstep;
  315. X    all_dstep = GridD.all_dstep;
  316. X    all_rstrt = GridD.all_rstrt;
  317. X    all_dstrt = GridD.all_dstrt;
  318. X    break;
  319. X  case Edit_mapwinsDialog:
  320. X    break;
  321. X  case X_parmsDialog:
  322. X    fprintf(stderr,"Cancelling the X parameters dialog\n");
  323. X    post_preview = X_parmsD.post_preview;
  324. X    post_landscape = X_parmsD.post_landscape;
  325. X    use_backup = X_parmsD.use_backup;
  326. X    is_color = X_parmsD.is_color;
  327. X    fixed_size = X_parmsD.fixed_size;
  328. X    fixed_width = X_parmsD.fixed_width;
  329. X    fixed_height = X_parmsD.fixed_height;
  330. X    break;
  331. X  default:
  332. X    fprintf(stderr,"No dialog to cancel\n");
  333. X    break;
  334. X  }
  335. X
  336. X  un_help();
  337. X  XtPopdown((Widget) closure);
  338. X}
  339. X
  340. X/* Utility widget functions */
  341. Xextern XtTranslations numbers_oneline, string_oneline;
  342. X
  343. XWidget Get_float(prompt, bottom_widge, form, flonum, flostr, flostr_len)
  344. X     char *prompt;
  345. X     Widget bottom_widge;
  346. X     Widget form;
  347. X     double flonum;
  348. X     char *flostr;
  349. X     int flostr_len;
  350. X{
  351. X  Arg Label_arg[10], Float_arg[10];
  352. X  Cardinal nLabel_args, nFloat_args;
  353. X  Widget t1, retw;
  354. X
  355. X  /* Labels should be left justified, and not have borders */
  356. X  XtSetArg(Label_arg[0], XtNhorizDistance,  4);
  357. X  XtSetArg(Label_arg[1], XtNfromVert,  bottom_widge);
  358. X  XtSetArg(Label_arg[2], XtNborderWidth, 0);
  359. X  XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
  360. X  nLabel_args = 4;
  361. X  t1 = 
  362. X    XtCreateManagedWidget(prompt,
  363. X              labelWidgetClass, form,
  364. X              Label_arg, nLabel_args);
  365. X
  366. X  sprintf(flostr, "%.4f", flonum);
  367. X  XtSetArg(Float_arg[0], XtNfromHoriz,  t1);
  368. X  XtSetArg(Float_arg[1], XtNfromVert,  bottom_widge);
  369. X  XtSetArg(Float_arg[2], XtNeditType, XttextEdit);
  370. X  XtSetArg(Float_arg[3], XtNinsertPosition, 0);
  371. X  XtSetArg(Float_arg[4], XtNlength, flostr_len);
  372. X  XtSetArg(Float_arg[5], XtNstring, flostr);
  373. X  XtSetArg(Float_arg[6], XtNtranslations, numbers_oneline);
  374. X       
  375. X  nFloat_args = 7;
  376. X  retw = 
  377. X    XtCreateManagedWidget("",
  378. X              asciiStringWidgetClass, form,
  379. X              Float_arg, nFloat_args);
  380. X  return retw;
  381. X}
  382. X
  383. X
  384. X
  385. XWidget Get_string(prompt, bottom_widge, form, strstr, str_len, fixed_len,
  386. X          min_len)
  387. X     char *prompt;
  388. X     Widget bottom_widge;
  389. X     Widget form;
  390. X     char *strstr;
  391. X     int str_len;
  392. X     int fixed_len, min_len;
  393. X{
  394. X  Arg Label_arg[10], Str_arg[10];
  395. X  Cardinal nLabel_args, nStr_args;
  396. X  Widget t1, retw;
  397. X
  398. X  /* Labels should be left justified, and not have borders */
  399. X  XtSetArg(Label_arg[0], XtNhorizDistance,  4);
  400. X  XtSetArg(Label_arg[1], XtNfromVert,  bottom_widge);
  401. X  XtSetArg(Label_arg[2], XtNborderWidth, 0);
  402. X  XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
  403. X  nLabel_args = 4;
  404. X  t1 = 
  405. X    XtCreateManagedWidget(prompt,
  406. X              labelWidgetClass, form,
  407. X              Label_arg, nLabel_args);
  408. X
  409. X  XtSetArg(Str_arg[0], XtNfromHoriz,  t1);
  410. X  XtSetArg(Str_arg[1], XtNfromVert,  bottom_widge);
  411. X  XtSetArg(Str_arg[2], XtNeditType, XttextEdit);
  412. X  XtSetArg(Str_arg[3], XtNinsertPosition, strlen(strstr));
  413. X  XtSetArg(Str_arg[4], XtNlength, str_len);
  414. X  XtSetArg(Str_arg[5], XtNstring, strstr);
  415. X  XtSetArg(Str_arg[6], XtNtranslations, string_oneline);
  416. X  if (fixed_len != 0)
  417. X    XtSetArg(Str_arg[7], XtNwidth, fixed_len);
  418. X  else
  419. X    XtSetArg(Str_arg[7], XtNwidth, MAX(min_len, strlen(strstr)*6.25));
  420. X  nStr_args = 8;
  421. X  retw = 
  422. X    XtCreateManagedWidget("",
  423. X              asciiStringWidgetClass, form,
  424. X              Str_arg, nStr_args);
  425. X  return retw;
  426. X}
  427. X
  428. XWidget Get_int(prompt, bottom_widge, form, intnum, intstr, intstr_len)
  429. X     char *prompt;
  430. X     Widget bottom_widge;
  431. X     Widget form;
  432. X     int intnum;
  433. X     char *intstr;
  434. X     int intstr_len;
  435. X{
  436. X  Arg Label_arg[10], Int_arg[10];
  437. X  Cardinal nLabel_args, nInt_args;
  438. X  Widget t1, retw;
  439. X
  440. X  /* Labels should be left justified, and not have borders */
  441. X  XtSetArg(Label_arg[0], XtNhorizDistance, 4);
  442. X  XtSetArg(Label_arg[1], XtNfromVert,  bottom_widge);
  443. X  XtSetArg(Label_arg[2], XtNborderWidth, 0);
  444. X  XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
  445. X  nLabel_args = 4;
  446. X  t1 = 
  447. X    XtCreateManagedWidget(prompt,
  448. X              labelWidgetClass, form,
  449. X              Label_arg, nLabel_args);
  450. X
  451. X  sprintf(intstr, "%d", intnum);
  452. X  XtSetArg(Int_arg[0], XtNfromHoriz,  t1);
  453. X  XtSetArg(Int_arg[1], XtNfromVert,  bottom_widge);
  454. X  XtSetArg(Int_arg[2], XtNeditType, XttextEdit);
  455. X  XtSetArg(Int_arg[3], XtNinsertPosition, 0);
  456. X  XtSetArg(Int_arg[4], XtNlength, intstr_len);
  457. X  XtSetArg(Int_arg[5], XtNstring, intstr);
  458. X  XtSetArg(Int_arg[6], XtNtranslations, numbers_oneline);
  459. X       
  460. X  nInt_args = 7;
  461. X  retw = 
  462. X    XtCreateManagedWidget("",
  463. X              asciiStringWidgetClass, form,
  464. X              Int_arg, nInt_args);
  465. X  return retw;
  466. X}
  467. X
  468. X
  469. X
  470. Xint local_conslookup(tag)
  471. Xchar *tag;
  472. X{
  473. X/*
  474. X * lookup "con.locs" for a matching tag, and then substitute initial values
  475. X * for ra, decl, scale, and label. File layout follows:
  476. X *
  477. X * com  13    25   10   Coma Bereneces
  478. X * cor  15.45 28   10   Corona Borealis
  479. X * 0....+....1....+....2....+....3
  480. X */
  481. X  FILE *cfile;
  482. X  int taglen;
  483. X  char cbuf[LINELEN+1];
  484. X  char tbuf[MAXPATHLEN];
  485. X  int i;
  486. X  
  487. X  if ((cfile = fopen(constfile, "r")) == NULL) {
  488. X    sprintf(tbuf,"open fail on %s", constfile);
  489. X    XBell(display, 50);
  490. X    D_comment(tbuf);
  491. X    return FALSE;
  492. X  }
  493. X  taglen = strlen(tag);
  494. X
  495. X  for (;;)
  496. X    {
  497. X      fgets(cbuf, LINELEN, cfile);
  498. X      if (ferror(cfile)) {
  499. X    sprintf(tbuf,"read error in '%s'", constfile);
  500. X    XBell(display, 50);
  501. X    D_comment(tbuf);
  502. X    return FALSE;
  503. X      };
  504. X      if (feof(cfile)) break;
  505. X      if (strncmp(tag, cbuf, taglen) == 0)    /* FOUND */
  506. X    {    
  507. X      if (4!=sscanf(cbuf,"%*5s%lf%lf%lf %[^\n]",
  508. X            &ra, &de, &sc, a_title)) {
  509. X        sprintf(tbuf,"bogus line in constellation file: %s", cbuf);
  510. X        XBell(display, 50);
  511. X        D_comment(tbuf);
  512. X        return FALSE;
  513. X      };
  514. X      ra    = ftod(ra)*15.0;
  515. X      de    = ftod(de);
  516. X      
  517. X      /* remove trailing \n */
  518. X      i = strlen(a_title);
  519. X      if (a_title[i-1] == '\n') a_title[i-1] = '\0';
  520. X      title = a_title;
  521. X      return TRUE;
  522. X    }
  523. X    }
  524. X  sprintf(tbuf,"Constellation '%s' not found", tag);
  525. X  XBell(display, 50);
  526. X  D_comment(tbuf);
  527. X  return FALSE;
  528. X}
  529. X
  530. Xupdate_string(wid, str)
  531. XWidget wid;
  532. Xchar *str;
  533. X{
  534. X  Arg args[2];
  535. X
  536. X  XtSetArg(args[0], XtNlabel, str);
  537. X  XtSetArg(args[1], XtNinsertPosition, strlen(str));
  538. X  XtSetValues(wid, args, (Cardinal)2);
  539. X  XtTextSetLastPos(wid, strlen(str));
  540. X}
  541. X
  542. Xvoid chart_apply(widget,closure,callData)
  543. X    Widget widget;
  544. X    caddr_t closure;        /* Widget */
  545. X    caddr_t callData;
  546. X{
  547. X  ra = htod(ChartD.ra_str)*15.0;
  548. X  de = htod(ChartD.de_str);
  549. X  sc = atof(ChartD.sc_str);
  550. X  title = a_title;
  551. X  constfile = a_constfile;
  552. X  if (a_constname[0])
  553. X    if (local_conslookup(a_constname)) {
  554. X      sprintf(ChartD.ra_str, "%.4f", dtof(ra/15.0));
  555. X      sprintf(ChartD.de_str, "%.4f", dtof(de));
  556. X      sprintf(ChartD.sc_str, "%.4f", sc);
  557. X      update_string(ChartD.ra_wid, ChartD.ra_str);
  558. X      update_string(ChartD.de_wid, ChartD.de_str);
  559. X      update_string(ChartD.sc_wid, ChartD.sc_str);
  560. X      update_string(ChartD.title_wid, title);
  561. X    }
  562. X  to_precess = atof(ChartD.to_p_str);
  563. X  precess = ((to_precess < 1999.99) || (to_precess > 2000.01));
  564. X}
  565. X
  566. Xvoid mag_apply(widget,closure,callData)
  567. X    Widget widget;
  568. X    caddr_t closure;        /* Widget */
  569. X    caddr_t callData;
  570. X{
  571. X  all_lbllim = atof(MagnitudesD.all_lbllim_str);
  572. X  all_maglim = atof(MagnitudesD.all_maglim_str);
  573. X  all_gklim = atof(MagnitudesD.all_gklim_str);
  574. X  use_lbllim = use_maglim = use_gklim = TRUE;
  575. X}
  576. X
  577. X
  578. X
  579. Xvoid layers_apply(widget,closure,callData)
  580. X    Widget widget;
  581. X    caddr_t closure;        /* Widget */
  582. X    caddr_t callData;
  583. X{
  584. X  int i, nlayers;
  585. X  Arg args[1];
  586. X  char *cp;
  587. X
  588. X  for (i = 0, nlayers = 0; i < MAXLAYRS; i++)
  589. X    if (all_layer[i] != 0) all_layer[nlayers++] = all_layer[i];
  590. X  for (i = nlayers;i < MAXLAYRS; i++) all_layer[i] = 0;
  591. X  numlayers = nlayers;
  592. X
  593. X  for (i = 0; i < MAXLAYRS; i++) {
  594. X    cp = lay_strings[all_layer[i]];
  595. X    XtSetArg(args[0], XtNlabel, cp);
  596. X
  597. X    XtSetValues(LayersD.wid[i], args, (Cardinal)1);
  598. X  }
  599. X}
  600. X
  601. X
  602. Xvoid mapf_apply(widget,closure,callData)
  603. X    Widget widget;
  604. X    caddr_t closure;        /* Widget */
  605. X    caddr_t callData;
  606. X{
  607. X  int i, nfiles;
  608. X  Arg args[2];
  609. X  char *cp;
  610. X
  611. X  for (i = 0, nfiles = 0; i < MAXMAPFILES; i++)
  612. X    if (mapfiles[i][0]) {
  613. X      strcpy(Map_filesD.mapfiles[nfiles], Map_filesD.mapfiles[i]);
  614. X      mapftypes[nfiles] = mapftypes[i];
  615. X      nfiles++;
  616. X    };
  617. X
  618. X  for (i = nfiles;i < MAXMAPFILES; i++) {
  619. X    strcpy(mapfiles[i], "");
  620. X    mapftypes[i] = LINEREAD;
  621. X  }
  622. X  nummapfiles = nfiles;
  623. X
  624. X  for (i = 0, nfiles = 0; i < MAXMAPFILES; i++)
  625. X    if (mapfiles[i][0]) {
  626. X      strcpy(Map_filesD.mapfiles[nfiles], Map_filesD.mapfiles[i]);
  627. X      mapftypes[nfiles] = mapftypes[i];
  628. X      nfiles++;
  629. X    };
  630. X
  631. X  for (i = nfiles;i < MAXMAPFILES; i++) {
  632. X    strcpy(mapfiles[i], "");
  633. X    mapftypes[i] = LINEREAD;
  634. X  }
  635. X  nummapfiles = nfiles;
  636. X
  637. X  for (i = 0; i < MAXMAPFILES; i++) {
  638. X    mapfiles[i] = Map_filesD.mapfiles[i];
  639. X    update_string(Map_filesD.file_wid[i], mapfiles[i]);
  640. X
  641. X
  642. X    cp = filetype_strings[mapftypes[i]];
  643. X    XtSetArg(args[0], XtNlabel, cp);
  644. X
  645. X    XtSetValues(Map_filesD.ftype_wid[i], args, (Cardinal)1);
  646. X  }
  647. X}
  648. X
  649. X
  650. X
  651. Xvoid maglbl_apply(widget,closure,callData)
  652. X    Widget widget;
  653. X    caddr_t closure;        /* Widget */
  654. X    caddr_t callData;
  655. X{
  656. X  all_vmin = atof(Magnitude_labelsD.all_vmin_str);
  657. X  all_vmax = atof(Magnitude_labelsD.all_vmax_str);
  658. X  use_vmin = TRUE;
  659. X}
  660. X
  661. Xvoid grid_apply(widget,closure,callData)
  662. X    Widget widget;
  663. X    caddr_t closure;        /* Widget */
  664. X    caddr_t callData;
  665. X{
  666. X  all_rstep = htod(GridD.all_rstep_str)*15.0;
  667. X  all_dstep = htod(GridD.all_dstep_str);
  668. X  all_rstrt = htod(GridD.all_rstrt_str)*15.0;
  669. X  all_dstrt = htod(GridD.all_dstrt_str);
  670. X  use_rstep = TRUE;
  671. X}
  672. X
  673. Xvoid xparm_apply(widget,closure,callData)
  674. X    Widget widget;
  675. X    caddr_t closure;        /* Widget */
  676. X    caddr_t callData;
  677. X{
  678. X  fixed_width = atoi(X_parmsD.fixed_width_str);
  679. X  fixed_height = atoi(X_parmsD.fixed_height_str);
  680. X}
  681. X
  682. X
  683. Xvoid save_load_apply(widget,closure,callData)
  684. X    Widget widget;
  685. X    caddr_t closure;        /* Widget */
  686. X    caddr_t callData;
  687. X{
  688. X  FILE *tfile;
  689. X
  690. X  if (write_rcfile[0])
  691. X    if ((tfile = fopen(write_rcfile, "w")) != NULL)
  692. X      if (rc_write(tfile)) {
  693. X    fclose(tfile);
  694. X    D_comment("Wrote .starrc file");
  695. X      }
  696. X
  697. X  switch (save_load_state) {
  698. X  case NO_MAPWIN:
  699. X    break;
  700. X  case READ_MAPWIN:
  701. X    read_mapwin_file = TRUE;
  702. X    write_mapwin_file = FALSE;
  703. X    break;
  704. X  case WRITE_MAPWIN:
  705. X    write_mapwin_file = TRUE;
  706. X    read_mapwin_file = FALSE;
  707. X    break;
  708. X  default:
  709. X    break;
  710. X  }
  711. X}
  712. X
  713. X
  714. X
  715. X
  716. X
  717. X/* Specific dialogs */
  718. X
  719. X/********** Dialog ***************/
  720. X/* Chart widget
  721. X   Get center ra and declination and scale,
  722. X   title
  723. X   constellation name to look up
  724. X   constellation lookup file
  725. X   invert or not
  726. X*/
  727. X
  728. Xvoid Chart(widget,closure,callData)
  729. X    Widget widget;
  730. X    caddr_t closure;        /* Widget */
  731. X    caddr_t callData;
  732. X{
  733. X  Widget pshell, pwidg, pform;
  734. X  static Arg shell_args[] = {
  735. X    { XtNwidth, (XtArgVal) 100},
  736. X  };
  737. X  void invert_toggle();
  738. X  char *dlog_name = "chart";
  739. X  Arg Button_arg[10], Label_arg[10];
  740. X  Cardinal NButton_args, NLabel_args;
  741. X  static XtCallbackRec callback[2];
  742. X  Widget twidge1, twidge2;
  743. X  Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
  744. X
  745. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  746. X  NButton_args = 1;
  747. X
  748. X  /* Labels should be left justified, and not have borders */
  749. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  750. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  751. X  NLabel_args = 2;
  752. X
  753. X
  754. X  /* Create shell and shell widget */
  755. X  pshell = XtCreatePopupShell(dlog_name,
  756. X                  topLevelShellWidgetClass,
  757. X                  widget, shell_args, XtNumber(shell_args));
  758. X  pwidg = 
  759. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  760. X
  761. X  /* Create this dialog box */
  762. X  pform = 
  763. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  764. X
  765. X
  766. X  /* Create widgets in the box
  767. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  768. X     or XtNhorizDistance and XtNvertDistance
  769. X     arg[1] sets horizontal position, arg[2] sets vertical
  770. X     Each has a callback if appropriate
  771. X     */
  772. X
  773. X
  774. X  twidge1 = 
  775. X    XtCreateManagedWidget("Specify Center and scale of chart",
  776. X              labelWidgetClass, pform, 
  777. X              Label_arg, NLabel_args);
  778. X
  779. X
  780. X
  781. X  /* get RA */
  782. X  ChartD.ra_wid =
  783. X    twidge2 = Get_float("Right Asc.:   ", twidge1, pform, dtof(ra/15.0),
  784. X              ChartD.ra_str,
  785. X              sizeof(ChartD.ra_str));
  786. X  twidge1 = twidge2;
  787. X
  788. X  /* get DEC */
  789. X  ChartD.de_wid =
  790. X    twidge2 = Get_float("Declination:  ", twidge1, pform, dtof(de),
  791. X              ChartD.de_str,
  792. X              sizeof(ChartD.de_str));
  793. X  twidge1 = twidge2;
  794. X
  795. X  /* Get Scale */
  796. X  ChartD.sc_wid =
  797. X    twidge2 = Get_float("Scale:        ", twidge1, pform, sc,
  798. X              ChartD.sc_str,
  799. X              sizeof(ChartD.sc_str));
  800. X  twidge1 = twidge2;
  801. X
  802. X
  803. X  /* Get Title */
  804. X  strcpy(a_title, title);
  805. X  ChartD.title_wid =
  806. X    twidge2 = Get_string("Title:        ", twidge1, pform,
  807. X              a_title,
  808. X              MAXPATHLEN, 0, 200);
  809. X  twidge1 = twidge2;
  810. X
  811. X
  812. X  /* Get Constellation to look up */
  813. X  strcpy(a_constname, "");
  814. X  twidge2 = Get_string("Constellation:", twidge1, pform,
  815. X              a_constname,
  816. X              4, 0, 50);
  817. X  twidge1 = twidge2;
  818. X
  819. X  /* Get Constellation data file */
  820. X  strcpy(a_constfile, constfile);
  821. X  twidge2 = Get_string("Constellation data file:", twidge1, pform,
  822. X              a_constfile,
  823. X              MAXPATHLEN, 0, 100);
  824. X  twidge1 = twidge2;
  825. X
  826. X
  827. X  /* Toggle invert */
  828. X  callback[0].callback = invert_toggle;
  829. X  callback[0].closure = (caddr_t) "Invert";
  830. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  831. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  832. X  NButton_args = 3;
  833. X  twidge2 =
  834. X    XtCreateManagedWidget( all_invert ? " Inverted ": "  Normal  ",
  835. X            commandWidgetClass, pform, Button_arg, NButton_args);
  836. X
  837. X  twidge1 = twidge2;
  838. X
  839. X  /* precess */
  840. X  ChartD.to_p_wid =
  841. X    twidge2 = Get_float("Precess to:   ", twidge1, pform, to_precess,
  842. X              ChartD.to_p_str,
  843. X              sizeof(ChartD.to_p_str));
  844. X  twidge1 = twidge2;
  845. X
  846. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  847. X
  848. X
  849. X  
  850. X
  851. X
  852. X  callback[0].callback = chart_apply;
  853. X  callback[0].closure = (caddr_t)pwidg;
  854. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  855. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  856. X  NButton_args = 3;
  857. X  apply_widge = 
  858. X    XtCreateManagedWidget( " Apply ",
  859. X            commandWidgetClass, pform, Button_arg, NButton_args);
  860. X
  861. X  callback[0].callback = do_dismiss;
  862. X  callback[0].closure = (caddr_t)pwidg;
  863. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  864. X  XtSetArg(Button_arg[2], XtNfromVert,  apply_widge);
  865. X  dismiss_widge = 
  866. X    XtCreateManagedWidget( "Dismiss",
  867. X            commandWidgetClass, pform, Button_arg, NButton_args);
  868. X
  869. X  callback[0].callback = do_cancel;
  870. X  callback[0].closure = (caddr_t)pwidg;
  871. X  XtSetArg(Button_arg[1], XtNfromHoriz,  dismiss_widge);
  872. X  cancel_widge = 
  873. X    XtCreateManagedWidget( "Cancel ",
  874. X            commandWidgetClass, pform, Button_arg, NButton_args);
  875. X
  876. X
  877. X  /* Save the current values */
  878. X  ChartD.ra = ra;
  879. X  ChartD.de = de;
  880. X  ChartD.sc = sc;
  881. X  ChartD.title = title;
  882. X  ChartD.constfile = constfile;
  883. X  ChartD.all_invert = all_invert;
  884. X  ChartD.precess = precess;
  885. X  ChartD.to_precess = to_precess;
  886. X
  887. X  current_dialog = ChartDialog;
  888. X  XtPopup(pwidg, XtGrabNonexclusive);
  889. X  chart_help();
  890. X}
  891. X
  892. X/********** Dialog ***************/
  893. X/* Type widget
  894. X   Set chart type to be either Main + thumbnail
  895. X                        or full page
  896. X*/
  897. Xvoid Type(widget,closure,callData)
  898. X    Widget widget;
  899. X    caddr_t closure;        /* Widget */
  900. X    caddr_t callData;
  901. X{
  902. X  Widget pshell, pwidg, pform;
  903. X  static Arg shell_args[] = {
  904. X    { XtNwidth, (XtArgVal) 100},
  905. X  };
  906. X  char *dlog_name = "type";
  907. X  void type_select();
  908. X  Arg Button_arg[10], Label_arg[10];
  909. X  Cardinal NButton_args, NLabel_args;
  910. X  static XtCallbackRec callback[2];
  911. X  Widget twidge1, twidge2;
  912. X  Widget bottom_widge, dismiss_widge, cancel_widge;
  913. X
  914. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  915. X  NButton_args = 1;
  916. X
  917. X  /* Labels should be left justified, and not have borders */
  918. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  919. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  920. X  NLabel_args = 2;
  921. X
  922. X
  923. X  /* Create shell and shell widget */
  924. X  pshell = XtCreatePopupShell(dlog_name,
  925. X                  topLevelShellWidgetClass,
  926. X                  widget, shell_args, XtNumber(shell_args));
  927. X  pwidg = 
  928. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  929. X
  930. X  /* Create this dialog box */
  931. X  pform = 
  932. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  933. X
  934. X
  935. X  /* Create widgets in the box
  936. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  937. X     or XtNhorizDistance and XtNvertDistance
  938. X     arg[1] sets horizontal position, arg[2] sets vertical
  939. X     Each has a callback if appropriate
  940. X     */
  941. X
  942. X
  943. X  twidge1 = 
  944. X    XtCreateManagedWidget("Specify Type of chart (press button)",
  945. X              labelWidgetClass, pform, 
  946. X              Label_arg, NLabel_args);
  947. X
  948. X  /* set type */
  949. X  callback[0].callback = type_select;
  950. X  callback[0].closure = (caddr_t) "chart_type";
  951. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  952. X  XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  953. X  NButton_args = 3;
  954. X  twidge2 =
  955. X    XtCreateManagedWidget(
  956. X              ((chart_type == THREEPART) ?
  957. X               "Main Map plus Thumbnail" :
  958. X               "Full Page              "),
  959. X              commandWidgetClass, pform, Button_arg, NButton_args);
  960. X
  961. X  twidge1 = twidge2;
  962. X
  963. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  964. X
  965. X
  966. X  
  967. X
  968. X
  969. X  callback[0].callback = do_dismiss;
  970. X  callback[0].closure = (caddr_t)pwidg;
  971. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  972. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  973. X  dismiss_widge = 
  974. X    XtCreateManagedWidget( "Dismiss",
  975. X            commandWidgetClass, pform, Button_arg, NButton_args);
  976. X
  977. X  callback[0].callback = do_cancel;
  978. X  callback[0].closure = (caddr_t)pwidg;
  979. X  XtSetArg(Button_arg[1], XtNfromHoriz,  dismiss_widge);
  980. X  cancel_widge = 
  981. X    XtCreateManagedWidget( "Cancel ",
  982. X            commandWidgetClass, pform, Button_arg, NButton_args);
  983. X
  984. X
  985. X  /* Save the current values */
  986. X  TypeD.chart_type = chart_type;
  987. X
  988. X  current_dialog = TypeDialog;
  989. X  XtPopup(pwidg, XtGrabNonexclusive);
  990. X  type_help();
  991. X}
  992. X
  993. X/********** Dialog ***************/
  994. X/* Magnitudes dialog
  995. X   Set lbllim, maglim, gklim
  996. X*/
  997. X
  998. Xvoid Magnitudes(widget,closure,callData)
  999. X    Widget widget;
  1000. X    caddr_t closure;        /* Widget */
  1001. X    caddr_t callData;
  1002. X{
  1003. X  Widget pshell, pwidg, pform;
  1004. X  static Arg shell_args[] = {
  1005. X    { XtNwidth, (XtArgVal) 100},
  1006. X  };
  1007. X  char *dlog_name = "magnitudes";
  1008. X  Arg Button_arg[10], Label_arg[10];
  1009. X  Cardinal NButton_args, NLabel_args;
  1010. X  static XtCallbackRec callback[2];
  1011. X  Widget twidge1, twidge2;
  1012. X  Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
  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 Magnitude limits for",
  1045. X              labelWidgetClass, pform, 
  1046. X              Label_arg, NLabel_args);
  1047. X
  1048. X  /* Get name limit (lbllim) */
  1049. X  MagnitudesD.all_lbllim_wid =
  1050. X    twidge2 = Get_float("Object names:  ", twidge1, pform, all_lbllim,
  1051. X              MagnitudesD.all_lbllim_str,
  1052. X              sizeof(MagnitudesD.all_lbllim_str));
  1053. X  twidge1 = twidge2;
  1054. X
  1055. X  /* Get label limit (gklim) */
  1056. X  MagnitudesD.all_gklim_wid =
  1057. X    twidge2 = Get_float("Bayer labels:  ", twidge1, pform, all_gklim,
  1058. X              MagnitudesD.all_gklim_str,
  1059. X              sizeof(MagnitudesD.all_gklim_str));
  1060. X  twidge1 = twidge2;
  1061. X
  1062. X  /* Get visibility limit (maglim) */
  1063. X  MagnitudesD.all_maglim_wid =
  1064. X    twidge2 = Get_float("Object symbol: ", twidge1, pform, all_maglim,
  1065. X              MagnitudesD.all_maglim_str,
  1066. X              sizeof(MagnitudesD.all_maglim_str));
  1067. X  twidge1 = twidge2;
  1068. X
  1069. X
  1070. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  1071. X
  1072. X
  1073. X  
  1074. X
  1075. X
  1076. X  callback[0].callback = mag_apply;
  1077. X  callback[0].closure = (caddr_t)pwidg;
  1078. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1079. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1080. X  NButton_args = 3;
  1081. X  apply_widge = 
  1082. X    XtCreateManagedWidget( " Apply ",
  1083. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1084. X  bottom_widge = apply_widge;
  1085. X
  1086. X  callback[0].callback = do_dismiss;
  1087. X  callback[0].closure = (caddr_t)pwidg;
  1088. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1089. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1090. X  dismiss_widge = 
  1091. X    XtCreateManagedWidget( "Dismiss",
  1092. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1093. X
  1094. X  callback[0].callback = do_cancel;
  1095. X  callback[0].closure = (caddr_t)pwidg;
  1096. X  XtSetArg(Button_arg[1], XtNfromHoriz,  dismiss_widge);
  1097. X  cancel_widge = 
  1098. X    XtCreateManagedWidget( "Cancel ",
  1099. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1100. X
  1101. X
  1102. X  /* Save the current values */
  1103. X  MagnitudesD.all_lbllim = all_lbllim;
  1104. X  MagnitudesD.all_maglim = all_maglim;
  1105. X  MagnitudesD.all_gklim = all_gklim;
  1106. X
  1107. X  current_dialog = MagnitudesDialog;
  1108. X  XtPopup(pwidg, XtGrabNonexclusive);
  1109. X  magnitudes_help();
  1110. X}
  1111. X
  1112. X/********** Dialog ***************/
  1113. X/* Layers dialog
  1114. X   Set all_layer
  1115. X*/
  1116. X
  1117. Xvoid Layers(widget,closure,callData)
  1118. X    Widget widget;
  1119. X    caddr_t closure;        /* Widget */
  1120. X    caddr_t callData;
  1121. X{
  1122. X  Widget pshell, pwidg, pform;
  1123. X  static Arg shell_args[] = {
  1124. X    { XtNwidth, (XtArgVal) 100},
  1125. X  };
  1126. X  char *dlog_name = "layers";
  1127. X  void layer_select();
  1128. X  Arg Button_arg[10], Label_arg[10];
  1129. X  Cardinal NButton_args, NLabel_args;
  1130. X  static XtCallbackRec callback[2];
  1131. X  Widget twidge1, twidge2;
  1132. X  Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
  1133. X  int i;
  1134. X  char *cp;
  1135. X
  1136. X
  1137. X  XtSetArg( Button_arg[0], XtNcallback, callback );
  1138. X  NButton_args = 1;
  1139. X
  1140. X  /* Labels should be left justified, and not have borders */
  1141. X  XtSetArg( Label_arg[0], XtNborderWidth, 0);
  1142. X  XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
  1143. X  NLabel_args = 2;
  1144. X
  1145. X
  1146. X  /* Create shell and shell widget */
  1147. X  pshell = XtCreatePopupShell(dlog_name,
  1148. X                  topLevelShellWidgetClass,
  1149. X                  widget, shell_args, XtNumber(shell_args));
  1150. X  pwidg = 
  1151. X    XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
  1152. X
  1153. X  /* Create this dialog box */
  1154. X  pform = 
  1155. X    XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
  1156. X
  1157. X
  1158. X  /* Create widgets in the box
  1159. X     Each has coordinates specified by either XtNfromHoriz and XtNfromVert
  1160. X     or XtNhorizDistance and XtNvertDistance
  1161. X     arg[1] sets horizontal position, arg[2] sets vertical
  1162. X     Each has a callback if appropriate
  1163. X     */
  1164. X
  1165. X
  1166. X  twidge1 = 
  1167. X    XtCreateManagedWidget("Specify Layer drawing order",
  1168. X              labelWidgetClass, pform, 
  1169. X              Label_arg, NLabel_args);
  1170. X
  1171. X  for (i = 0; i < MAXLAYRS; i++) {
  1172. X    LayersD.laynum[i] = i;
  1173. X    
  1174. X    callback[0].callback = layer_select;
  1175. X    callback[0].closure = (caddr_t) ((int *) &(LayersD.laynum[i]));
  1176. X    XtSetArg(Button_arg[0], XtNcallback, callback);
  1177. X    XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1178. X    XtSetArg(Button_arg[2], XtNfromVert,  twidge1);
  1179. X
  1180. X    NButton_args = 3;
  1181. X    cp = lay_strings[all_layer[i]];
  1182. X    LayersD.wid[i] = 
  1183. X      twidge2 =
  1184. X    XtCreateManagedWidget(cp,
  1185. X                  commandWidgetClass, pform,
  1186. X                  Button_arg, NButton_args);
  1187. X
  1188. X    twidge1 = twidge2;
  1189. X  }
  1190. X
  1191. X  bottom_widge = twidge1;    /* The bottommost widget so far */
  1192. X
  1193. X
  1194. X  
  1195. X  callback[0].callback = layers_apply;
  1196. X  callback[0].closure = (caddr_t)pwidg;
  1197. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1198. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1199. X  NButton_args = 3;
  1200. X  apply_widge = 
  1201. X    XtCreateManagedWidget( " Apply ",
  1202. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1203. X  bottom_widge = apply_widge;
  1204. X
  1205. X  callback[0].callback = do_dismiss;
  1206. X  callback[0].closure = (caddr_t)pwidg;
  1207. X  XtSetArg(Button_arg[0], XtNcallback, callback);
  1208. X  XtSetArg(Button_arg[1], XtNhorizDistance,  4);
  1209. X  XtSetArg(Button_arg[2], XtNfromVert,  bottom_widge);
  1210. X  dismiss_widge = 
  1211. X    XtCreateManagedWidget( "Dismiss",
  1212. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1213. X
  1214. X  callback[0].callback = do_cancel;
  1215. X  callback[0].closure = (caddr_t)pwidg;
  1216. X  XtSetArg(Button_arg[1], XtNfromHoriz,  dismiss_widge);
  1217. X  cancel_widge = 
  1218. X    XtCreateManagedWidget( "Cancel ",
  1219. X            commandWidgetClass, pform, Button_arg, NButton_args);
  1220. X
  1221. X
  1222. X  /* Save the current values */
  1223. X  for (i = 0; i < MAXLAYRS; i++)
  1224. END_OF_FILE
  1225. if test 31360 -ne `wc -c <'starchart/sXawD.c.aa'`; then
  1226.     echo shar: \"'starchart/sXawD.c.aa'\" unpacked with wrong size!
  1227. fi
  1228. # end of 'starchart/sXawD.c.aa'
  1229. fi
  1230. echo shar: End of archive 20 \(of 32\).
  1231. cp /dev/null ark20isdone
  1232. MISSING=""
  1233. 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
  1234.     if test ! -f ark${I}isdone ; then
  1235.     MISSING="${MISSING} ${I}"
  1236.     fi
  1237. done
  1238. if test "${MISSING}" = "" ; then
  1239.     echo You have unpacked all 32 archives.
  1240.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1241. else
  1242.     echo You still need to unpack the following archives:
  1243.     echo "        " ${MISSING}
  1244. fi
  1245. ##  End of shell archive.
  1246. exit 0
  1247.  
  1248.