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