home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-06 | 33.2 KB | 1,241 lines |
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 20 (of 32)."
- # Contents: starchart/sXawD.c.aa
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'starchart/sXawD.c.aa' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'starchart/sXawD.c.aa'\"
- else
- echo shar: Extracting \"'starchart/sXawD.c.aa'\" \(31360 characters\)
- sed "s/^X//" >'starchart/sXawD.c.aa' <<'END_OF_FILE'
- X/*
- X * Dialogs for starXaw
- X * Rewritten from scratch July 1989
- X *
- X * Copyright (c) 1990 by Craig Counterman. All rights reserved.
- X *
- X * This software may be redistributed freely, not sold.
- X * This copyright notice and disclaimer of warranty must remain
- X * unchanged.
- X *
- X * No representation is made about the suitability of this
- X * software for any purpose. It is provided "as is" without express or
- X * implied warranty, to the extent permitted by applicable law.
- X *
- X */
- X
- Xstatic char rcsid[]="$Header: starXawDlog.c,v 1.10 90/03/10 15:33:47 ccount Exp $";
- X
- X#include <stdio.h>
- X#include <math.h>
- X
- X#include "star3.h"
- X#include "starXaw.h"
- X
- X#ifndef SYSV
- X#include <strings.h>
- X#else
- X#include <string.h>
- X#endif
- X
- X#include <X11/cursorfont.h>
- X#include <X11/Intrinsic.h>
- X#include <X11/StringDefs.h>
- X#include <X11/Shell.h>
- X#ifdef X11R4
- X#include <X11/Xaw/Command.h>
- X#include <X11/Xaw/Form.h>
- X#include <X11/Xaw/Box.h>
- X#define ASCII_STRING
- X#define XAW_BC
- X#include <X11/Xaw/AsciiText.h>
- X#else
- X#include <X11/Command.h>
- X#include <X11/Form.h>
- X#include <X11/Box.h>
- X#include <X11/AsciiText.h>
- X#endif
- X
- X#include "starXawDlog.h"
- X
- Xchar *malloc();
- X
- X#define LINELEN 82
- X
- X#define MAX(a,b) ((a)>(b)?(a):(b))
- X#define MIN(a,b) ((a)<(b)?(a):(b))
- X
- Xextern char *prog;
- X
- X/* Externs */
- Xextern int g_argc;
- Xextern char **g_argv;
- X
- Xextern char *title;
- X
- X/* From starchart.c */
- Xextern double ra, de, sc;
- Xextern double all_lbllim, all_maglim, all_gklim;
- Xextern int use_lbllim, use_maglim, use_gklim;
- X
- Xextern int precess;
- Xextern double to_precess;
- X
- Xextern double all_vmin, all_vmax;
- Xextern int use_vmin;
- Xextern int nomaglbls;
- X
- Xextern double all_rstep, all_dstep;
- Xextern int use_rstep;
- Xextern double all_rstrt, all_dstrt;
- Xextern int no_ra_grid;
- Xextern int no_dec_grid;
- X
- Xextern int all_invert;
- X
- Xextern int chart_type;
- X
- Xextern int all_proj_mode;
- X
- Xextern char *rcfile;
- X
- Xextern char *constfile;
- Xextern char *boundfile;
- Xextern char boundftype;
- Xextern char *patternfile;
- Xextern char pattftype;
- Xextern char *cnamefile;
- Xextern char cnameftype;
- Xextern char *mapfiles[];
- Xextern int mapftypes[];
- Xextern int nummapfiles;
- X
- Xextern mapwindow *mapwin[];
- Xextern int numwins;
- X
- Xextern int cur_function;
- Xextern int cur_map_type;
- Xextern int cur_map_tag;
- Xextern char *cur_tag_field;
- Xextern char *cur_file_name;
- X
- Xextern int read_mapwin_file;
- Xextern int write_mapwin_file;
- Xextern char mapwin_file[];
- X
- X
- Xextern int all_layer[MAXLAYRS];
- Xextern int numlayers;
- X
- X/* storage area big enough for inputs */
- X#ifndef MAXPATHLEN
- X#define MAXPATHLEN 1025
- X#endif
- Xextern char a_title[];
- Xextern char a_starfile[];
- Xextern char a_indexfile[];
- Xextern char a_planetfile[];
- Xextern char a_nebfile[];
- Xextern char a_constfile[];
- Xextern char a_boundfile[];
- Xextern char a_patternfile[];
- Xextern char a_cnamefile[];
- Xextern char a_userfile[][MAXPATHLEN];
- X
- X/* local similar buffers */
- Xchar a_constname[MAXPATHLEN];
- Xchar a_rcfile[MAXPATHLEN];
- Xchar write_rcfile[MAXPATHLEN];
- X
- X#define READ_MAPWIN 1
- X#define WRITE_MAPWIN 2
- X#define NO_MAPWIN 0
- Xint save_load_state;
- Xchar *save_load_str[] = {
- X " No mapwin file",
- X " Read mapwin file",
- X "Write mapwin file"
- X};
- X
- X/* Shared with starXawMwin.c */
- XBool edit_mapwins = False;
- X
- X/* starX11 X items */
- Xextern Display *display; /* connection to display server */
- Xextern Window root, window; /* window to graphics in */
- Xextern Drawable draw_into;
- Xextern Colormap default_cmap; /* colormap */
- Xextern GC default_GC; /* graphics context */
- Xextern XFontStruct *default_font; /* default font */
- Xextern XFontStruct *greek_font; /* Greek font */
- Xextern Pixmap backup; /* backup for expose events */
- Xextern Pixel black, white, foreground, background;
- Xextern Pixel *pixels; /* color map cells */
- Xextern Pixel *star_pixels; /* color map cells for super color stars */
- Xextern int ncolors, star_colors;
- Xextern XEvent event; /* event structure */
- Xextern XGCValues values_GC; /* modify GC */
- Xextern unsigned int width, height;
- X
- Xextern Boolean reverse;
- X
- Xextern Bool use_backup;
- Xextern Bool hide_drawing;
- Xextern Bool post_preview;
- Xextern Bool post_landscape;
- Xextern Bool use_x_dashes;
- Xextern Bool is_color; /* Is it color? */
- Xextern Bool is_super_color; /* Is it many color? */
- X
- X/* From starXaw */
- Xextern Bool fixed_size;
- Xextern int fixed_width;
- Xextern int fixed_height;
- X
- X
- Xint pp_status;
- X
- Xvoid Chart(), Type(), Magnitudes(), Layers(), Map_files(),
- X Projection_mode(), Magnitude_labels(), Grid(), Edit_mapwins(), X_parms();
- X
- XButton_set dlogbuttons[] = {
- X {"Chart", Chart},
- X {"Type", Type},
- X {"Magnitudes", Magnitudes},
- X {"Layers", Layers},
- X {"Data Files", Map_files},
- X {"Projection Mode", Projection_mode},
- X {"Magnitude Labels", Magnitude_labels},
- X {"Grid", Grid},
- X {"Additional Control", Edit_mapwins},
- X {"X Parameters", X_parms},
- X {"", NULL},
- X};
- X
- X
- X/****/
- X/* The dialog boxes */
- X/* There must be a better way, but for now, use this variable to indicate
- X which dialog is being cancelled */
- XDlogType current_dialog = NoDialog;
- X
- XChartD_S ChartD;
- XTypeD_S TypeD;
- XMagnitudesD_S MagnitudesD;
- XLayersD_S LayersD;
- XMap_filesD_S Map_filesD;
- XProjection_modeD_S Projection_modeD;
- XMagnitude_labelsD_S Magnitude_labelsD;
- XGridD_S GridD;
- XEdit_mapwinsD_S Edit_mapwinsD;
- XX_parmsD_S X_parmsD;
- X
- X
- X
- X
- X/* It's OK */
- Xvoid do_dismiss(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X un_help();
- X XtPopdown((Widget) closure);
- X}
- X
- X/* It's not OK */
- Xvoid do_cancel(widget,closure,callData)
- X Widget widget;
- X caddr_t closure;
- X caddr_t callData;
- X{
- X int i;
- X
- X switch (current_dialog) {
- X case ChartDialog:
- X fprintf(stderr,"Cancelling the chart dialog\n");
- X ra = ChartD.ra;
- X de = ChartD.de;
- X sc = ChartD.sc;
- X title = ChartD.title;
- X constfile = ChartD.constfile;
- X all_invert = ChartD.all_invert;
- X precess = ChartD.precess;
- X to_precess = ChartD.to_precess;
- X break;
- X case TypeDialog:
- X fprintf(stderr,"Cancelling the type dialog\n");
- X chart_type = TypeD.chart_type;
- X break;
- X case MagnitudesDialog:
- X fprintf(stderr,"Cancelling the magnitudes dialog\n");
- X all_lbllim = MagnitudesD.all_lbllim;
- X all_maglim = MagnitudesD.all_maglim;
- X all_gklim = MagnitudesD.all_gklim;
- X break;
- X case LayersDialog:
- X fprintf(stderr,"Cancelling the layers dialog\n");
- X for (i = 0; i < MAXLAYRS; i++)
- X all_layer[i] = LayersD.all_layer[i];
- X numlayers = LayersD.numlayers;
- X break;
- X case Map_filesDialog:
- X fprintf(stderr,"Cancelling the files dialog\n");
- X for (i = 0; i < MAXMAPFILES; i++) {
- X strcpy(mapfiles[i], Map_filesD.mapfiles[i]);
- X mapftypes[i] = Map_filesD.mapftypes[i];
- X }
- X nummapfiles = Map_filesD.nummapfiles;
- X break;
- X case Projection_modeDialog:
- X fprintf(stderr,"Cancelling the projection mode dialog\n");
- X all_proj_mode = Projection_modeD.all_proj_mode;
- X break;
- X case Magnitude_labelsDialog:
- X fprintf(stderr,"Cancelling the magnitude labels dialog\n");
- X all_vmin = Magnitude_labelsD.all_vmin;
- X all_vmax = Magnitude_labelsD.all_vmax;
- X break;
- X case GridDialog:
- X fprintf(stderr,"Cancelling the grid dialog\n");
- X all_rstep = GridD.all_rstep;
- X all_dstep = GridD.all_dstep;
- X all_rstrt = GridD.all_rstrt;
- X all_dstrt = GridD.all_dstrt;
- X break;
- X case Edit_mapwinsDialog:
- X break;
- X case X_parmsDialog:
- X fprintf(stderr,"Cancelling the X parameters dialog\n");
- X post_preview = X_parmsD.post_preview;
- X post_landscape = X_parmsD.post_landscape;
- X use_backup = X_parmsD.use_backup;
- X is_color = X_parmsD.is_color;
- X fixed_size = X_parmsD.fixed_size;
- X fixed_width = X_parmsD.fixed_width;
- X fixed_height = X_parmsD.fixed_height;
- X break;
- X default:
- X fprintf(stderr,"No dialog to cancel\n");
- X break;
- X }
- X
- X un_help();
- X XtPopdown((Widget) closure);
- X}
- X
- X/* Utility widget functions */
- Xextern XtTranslations numbers_oneline, string_oneline;
- X
- XWidget Get_float(prompt, bottom_widge, form, flonum, flostr, flostr_len)
- X char *prompt;
- X Widget bottom_widge;
- X Widget form;
- X double flonum;
- X char *flostr;
- X int flostr_len;
- X{
- X Arg Label_arg[10], Float_arg[10];
- X Cardinal nLabel_args, nFloat_args;
- X Widget t1, retw;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg(Label_arg[0], XtNhorizDistance, 4);
- X XtSetArg(Label_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Label_arg[2], XtNborderWidth, 0);
- X XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
- X nLabel_args = 4;
- X t1 =
- X XtCreateManagedWidget(prompt,
- X labelWidgetClass, form,
- X Label_arg, nLabel_args);
- X
- X sprintf(flostr, "%.4f", flonum);
- X XtSetArg(Float_arg[0], XtNfromHoriz, t1);
- X XtSetArg(Float_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Float_arg[2], XtNeditType, XttextEdit);
- X XtSetArg(Float_arg[3], XtNinsertPosition, 0);
- X XtSetArg(Float_arg[4], XtNlength, flostr_len);
- X XtSetArg(Float_arg[5], XtNstring, flostr);
- X XtSetArg(Float_arg[6], XtNtranslations, numbers_oneline);
- X
- X nFloat_args = 7;
- X retw =
- X XtCreateManagedWidget("",
- X asciiStringWidgetClass, form,
- X Float_arg, nFloat_args);
- X return retw;
- X}
- X
- X
- X
- XWidget Get_string(prompt, bottom_widge, form, strstr, str_len, fixed_len,
- X min_len)
- X char *prompt;
- X Widget bottom_widge;
- X Widget form;
- X char *strstr;
- X int str_len;
- X int fixed_len, min_len;
- X{
- X Arg Label_arg[10], Str_arg[10];
- X Cardinal nLabel_args, nStr_args;
- X Widget t1, retw;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg(Label_arg[0], XtNhorizDistance, 4);
- X XtSetArg(Label_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Label_arg[2], XtNborderWidth, 0);
- X XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
- X nLabel_args = 4;
- X t1 =
- X XtCreateManagedWidget(prompt,
- X labelWidgetClass, form,
- X Label_arg, nLabel_args);
- X
- X XtSetArg(Str_arg[0], XtNfromHoriz, t1);
- X XtSetArg(Str_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Str_arg[2], XtNeditType, XttextEdit);
- X XtSetArg(Str_arg[3], XtNinsertPosition, strlen(strstr));
- X XtSetArg(Str_arg[4], XtNlength, str_len);
- X XtSetArg(Str_arg[5], XtNstring, strstr);
- X XtSetArg(Str_arg[6], XtNtranslations, string_oneline);
- X if (fixed_len != 0)
- X XtSetArg(Str_arg[7], XtNwidth, fixed_len);
- X else
- X XtSetArg(Str_arg[7], XtNwidth, MAX(min_len, strlen(strstr)*6.25));
- X nStr_args = 8;
- X retw =
- X XtCreateManagedWidget("",
- X asciiStringWidgetClass, form,
- X Str_arg, nStr_args);
- X return retw;
- X}
- X
- XWidget Get_int(prompt, bottom_widge, form, intnum, intstr, intstr_len)
- X char *prompt;
- X Widget bottom_widge;
- X Widget form;
- X int intnum;
- X char *intstr;
- X int intstr_len;
- X{
- X Arg Label_arg[10], Int_arg[10];
- X Cardinal nLabel_args, nInt_args;
- X Widget t1, retw;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg(Label_arg[0], XtNhorizDistance, 4);
- X XtSetArg(Label_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Label_arg[2], XtNborderWidth, 0);
- X XtSetArg(Label_arg[3], XtNjustify, XtJustifyLeft);
- X nLabel_args = 4;
- X t1 =
- X XtCreateManagedWidget(prompt,
- X labelWidgetClass, form,
- X Label_arg, nLabel_args);
- X
- X sprintf(intstr, "%d", intnum);
- X XtSetArg(Int_arg[0], XtNfromHoriz, t1);
- X XtSetArg(Int_arg[1], XtNfromVert, bottom_widge);
- X XtSetArg(Int_arg[2], XtNeditType, XttextEdit);
- X XtSetArg(Int_arg[3], XtNinsertPosition, 0);
- X XtSetArg(Int_arg[4], XtNlength, intstr_len);
- X XtSetArg(Int_arg[5], XtNstring, intstr);
- X XtSetArg(Int_arg[6], XtNtranslations, numbers_oneline);
- X
- X nInt_args = 7;
- X retw =
- X XtCreateManagedWidget("",
- X asciiStringWidgetClass, form,
- X Int_arg, nInt_args);
- X return retw;
- X}
- X
- X
- X
- Xint local_conslookup(tag)
- Xchar *tag;
- X{
- X/*
- X * lookup "con.locs" for a matching tag, and then substitute initial values
- X * for ra, decl, scale, and label. File layout follows:
- X *
- X * com 13 25 10 Coma Bereneces
- X * cor 15.45 28 10 Corona Borealis
- X * 0....+....1....+....2....+....3
- X */
- X FILE *cfile;
- X int taglen;
- X char cbuf[LINELEN+1];
- X char tbuf[MAXPATHLEN];
- X int i;
- X
- X if ((cfile = fopen(constfile, "r")) == NULL) {
- X sprintf(tbuf,"open fail on %s", constfile);
- X XBell(display, 50);
- X D_comment(tbuf);
- X return FALSE;
- X }
- X taglen = strlen(tag);
- X
- X for (;;)
- X {
- X fgets(cbuf, LINELEN, cfile);
- X if (ferror(cfile)) {
- X sprintf(tbuf,"read error in '%s'", constfile);
- X XBell(display, 50);
- X D_comment(tbuf);
- X return FALSE;
- X };
- X if (feof(cfile)) break;
- X if (strncmp(tag, cbuf, taglen) == 0) /* FOUND */
- X {
- X if (4!=sscanf(cbuf,"%*5s%lf%lf%lf %[^\n]",
- X &ra, &de, &sc, a_title)) {
- X sprintf(tbuf,"bogus line in constellation file: %s", cbuf);
- X XBell(display, 50);
- X D_comment(tbuf);
- X return FALSE;
- X };
- X ra = ftod(ra)*15.0;
- X de = ftod(de);
- X
- X /* remove trailing \n */
- X i = strlen(a_title);
- X if (a_title[i-1] == '\n') a_title[i-1] = '\0';
- X title = a_title;
- X return TRUE;
- X }
- X }
- X sprintf(tbuf,"Constellation '%s' not found", tag);
- X XBell(display, 50);
- X D_comment(tbuf);
- X return FALSE;
- X}
- X
- Xupdate_string(wid, str)
- XWidget wid;
- Xchar *str;
- X{
- X Arg args[2];
- X
- X XtSetArg(args[0], XtNlabel, str);
- X XtSetArg(args[1], XtNinsertPosition, strlen(str));
- X XtSetValues(wid, args, (Cardinal)2);
- X XtTextSetLastPos(wid, strlen(str));
- X}
- X
- Xvoid chart_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X ra = htod(ChartD.ra_str)*15.0;
- X de = htod(ChartD.de_str);
- X sc = atof(ChartD.sc_str);
- X title = a_title;
- X constfile = a_constfile;
- X if (a_constname[0])
- X if (local_conslookup(a_constname)) {
- X sprintf(ChartD.ra_str, "%.4f", dtof(ra/15.0));
- X sprintf(ChartD.de_str, "%.4f", dtof(de));
- X sprintf(ChartD.sc_str, "%.4f", sc);
- X update_string(ChartD.ra_wid, ChartD.ra_str);
- X update_string(ChartD.de_wid, ChartD.de_str);
- X update_string(ChartD.sc_wid, ChartD.sc_str);
- X update_string(ChartD.title_wid, title);
- X }
- X to_precess = atof(ChartD.to_p_str);
- X precess = ((to_precess < 1999.99) || (to_precess > 2000.01));
- X}
- X
- Xvoid mag_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X all_lbllim = atof(MagnitudesD.all_lbllim_str);
- X all_maglim = atof(MagnitudesD.all_maglim_str);
- X all_gklim = atof(MagnitudesD.all_gklim_str);
- X use_lbllim = use_maglim = use_gklim = TRUE;
- X}
- X
- X
- X
- Xvoid layers_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X int i, nlayers;
- X Arg args[1];
- X char *cp;
- X
- X for (i = 0, nlayers = 0; i < MAXLAYRS; i++)
- X if (all_layer[i] != 0) all_layer[nlayers++] = all_layer[i];
- X for (i = nlayers;i < MAXLAYRS; i++) all_layer[i] = 0;
- X numlayers = nlayers;
- X
- X for (i = 0; i < MAXLAYRS; i++) {
- X cp = lay_strings[all_layer[i]];
- X XtSetArg(args[0], XtNlabel, cp);
- X
- X XtSetValues(LayersD.wid[i], args, (Cardinal)1);
- X }
- X}
- X
- X
- Xvoid mapf_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X int i, nfiles;
- X Arg args[2];
- X char *cp;
- X
- X for (i = 0, nfiles = 0; i < MAXMAPFILES; i++)
- X if (mapfiles[i][0]) {
- X strcpy(Map_filesD.mapfiles[nfiles], Map_filesD.mapfiles[i]);
- X mapftypes[nfiles] = mapftypes[i];
- X nfiles++;
- X };
- X
- X for (i = nfiles;i < MAXMAPFILES; i++) {
- X strcpy(mapfiles[i], "");
- X mapftypes[i] = LINEREAD;
- X }
- X nummapfiles = nfiles;
- X
- X for (i = 0, nfiles = 0; i < MAXMAPFILES; i++)
- X if (mapfiles[i][0]) {
- X strcpy(Map_filesD.mapfiles[nfiles], Map_filesD.mapfiles[i]);
- X mapftypes[nfiles] = mapftypes[i];
- X nfiles++;
- X };
- X
- X for (i = nfiles;i < MAXMAPFILES; i++) {
- X strcpy(mapfiles[i], "");
- X mapftypes[i] = LINEREAD;
- X }
- X nummapfiles = nfiles;
- X
- X for (i = 0; i < MAXMAPFILES; i++) {
- X mapfiles[i] = Map_filesD.mapfiles[i];
- X update_string(Map_filesD.file_wid[i], mapfiles[i]);
- X
- X
- X cp = filetype_strings[mapftypes[i]];
- X XtSetArg(args[0], XtNlabel, cp);
- X
- X XtSetValues(Map_filesD.ftype_wid[i], args, (Cardinal)1);
- X }
- X}
- X
- X
- X
- Xvoid maglbl_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X all_vmin = atof(Magnitude_labelsD.all_vmin_str);
- X all_vmax = atof(Magnitude_labelsD.all_vmax_str);
- X use_vmin = TRUE;
- X}
- X
- Xvoid grid_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X all_rstep = htod(GridD.all_rstep_str)*15.0;
- X all_dstep = htod(GridD.all_dstep_str);
- X all_rstrt = htod(GridD.all_rstrt_str)*15.0;
- X all_dstrt = htod(GridD.all_dstrt_str);
- X use_rstep = TRUE;
- X}
- X
- Xvoid xparm_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X fixed_width = atoi(X_parmsD.fixed_width_str);
- X fixed_height = atoi(X_parmsD.fixed_height_str);
- X}
- X
- X
- Xvoid save_load_apply(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X FILE *tfile;
- X
- X if (write_rcfile[0])
- X if ((tfile = fopen(write_rcfile, "w")) != NULL)
- X if (rc_write(tfile)) {
- X fclose(tfile);
- X D_comment("Wrote .starrc file");
- X }
- X
- X switch (save_load_state) {
- X case NO_MAPWIN:
- X break;
- X case READ_MAPWIN:
- X read_mapwin_file = TRUE;
- X write_mapwin_file = FALSE;
- X break;
- X case WRITE_MAPWIN:
- X write_mapwin_file = TRUE;
- X read_mapwin_file = FALSE;
- X break;
- X default:
- X break;
- X }
- X}
- X
- X
- X
- X
- X
- X/* Specific dialogs */
- X
- X/********** Dialog ***************/
- X/* Chart widget
- X Get center ra and declination and scale,
- X title
- X constellation name to look up
- X constellation lookup file
- X invert or not
- X*/
- X
- Xvoid Chart(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X Widget pshell, pwidg, pform;
- X static Arg shell_args[] = {
- X { XtNwidth, (XtArgVal) 100},
- X };
- X void invert_toggle();
- X char *dlog_name = "chart";
- X Arg Button_arg[10], Label_arg[10];
- X Cardinal NButton_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
- X
- X XtSetArg( Button_arg[0], XtNcallback, callback );
- X NButton_args = 1;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg( Label_arg[0], XtNborderWidth, 0);
- X XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
- X NLabel_args = 2;
- X
- X
- X /* Create shell and shell widget */
- X pshell = XtCreatePopupShell(dlog_name,
- X topLevelShellWidgetClass,
- X widget, shell_args, XtNumber(shell_args));
- X pwidg =
- X XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
- X
- X /* Create this dialog box */
- X pform =
- X XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
- X
- X
- X /* Create widgets in the box
- X Each has coordinates specified by either XtNfromHoriz and XtNfromVert
- X or XtNhorizDistance and XtNvertDistance
- X arg[1] sets horizontal position, arg[2] sets vertical
- X Each has a callback if appropriate
- X */
- X
- X
- X twidge1 =
- X XtCreateManagedWidget("Specify Center and scale of chart",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X
- X
- X
- X /* get RA */
- X ChartD.ra_wid =
- X twidge2 = Get_float("Right Asc.: ", twidge1, pform, dtof(ra/15.0),
- X ChartD.ra_str,
- X sizeof(ChartD.ra_str));
- X twidge1 = twidge2;
- X
- X /* get DEC */
- X ChartD.de_wid =
- X twidge2 = Get_float("Declination: ", twidge1, pform, dtof(de),
- X ChartD.de_str,
- X sizeof(ChartD.de_str));
- X twidge1 = twidge2;
- X
- X /* Get Scale */
- X ChartD.sc_wid =
- X twidge2 = Get_float("Scale: ", twidge1, pform, sc,
- X ChartD.sc_str,
- X sizeof(ChartD.sc_str));
- X twidge1 = twidge2;
- X
- X
- X /* Get Title */
- X strcpy(a_title, title);
- X ChartD.title_wid =
- X twidge2 = Get_string("Title: ", twidge1, pform,
- X a_title,
- X MAXPATHLEN, 0, 200);
- X twidge1 = twidge2;
- X
- X
- X /* Get Constellation to look up */
- X strcpy(a_constname, "");
- X twidge2 = Get_string("Constellation:", twidge1, pform,
- X a_constname,
- X 4, 0, 50);
- X twidge1 = twidge2;
- X
- X /* Get Constellation data file */
- X strcpy(a_constfile, constfile);
- X twidge2 = Get_string("Constellation data file:", twidge1, pform,
- X a_constfile,
- X MAXPATHLEN, 0, 100);
- X twidge1 = twidge2;
- X
- X
- X /* Toggle invert */
- X callback[0].callback = invert_toggle;
- X callback[0].closure = (caddr_t) "Invert";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X NButton_args = 3;
- X twidge2 =
- X XtCreateManagedWidget( all_invert ? " Inverted ": " Normal ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X /* precess */
- X ChartD.to_p_wid =
- X twidge2 = Get_float("Precess to: ", twidge1, pform, to_precess,
- X ChartD.to_p_str,
- X sizeof(ChartD.to_p_str));
- X twidge1 = twidge2;
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X
- X
- X
- X callback[0].callback = chart_apply;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X NButton_args = 3;
- X apply_widge =
- X XtCreateManagedWidget( " Apply ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X callback[0].callback = do_dismiss;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, apply_widge);
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X callback[0].callback = do_cancel;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNfromHoriz, dismiss_widge);
- X cancel_widge =
- X XtCreateManagedWidget( "Cancel ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X
- X /* Save the current values */
- X ChartD.ra = ra;
- X ChartD.de = de;
- X ChartD.sc = sc;
- X ChartD.title = title;
- X ChartD.constfile = constfile;
- X ChartD.all_invert = all_invert;
- X ChartD.precess = precess;
- X ChartD.to_precess = to_precess;
- X
- X current_dialog = ChartDialog;
- X XtPopup(pwidg, XtGrabNonexclusive);
- X chart_help();
- X}
- X
- X/********** Dialog ***************/
- X/* Type widget
- X Set chart type to be either Main + thumbnail
- X or full page
- X*/
- Xvoid Type(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X Widget pshell, pwidg, pform;
- X static Arg shell_args[] = {
- X { XtNwidth, (XtArgVal) 100},
- X };
- X char *dlog_name = "type";
- X void type_select();
- X Arg Button_arg[10], Label_arg[10];
- X Cardinal NButton_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, dismiss_widge, cancel_widge;
- X
- X XtSetArg( Button_arg[0], XtNcallback, callback );
- X NButton_args = 1;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg( Label_arg[0], XtNborderWidth, 0);
- X XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
- X NLabel_args = 2;
- X
- X
- X /* Create shell and shell widget */
- X pshell = XtCreatePopupShell(dlog_name,
- X topLevelShellWidgetClass,
- X widget, shell_args, XtNumber(shell_args));
- X pwidg =
- X XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
- X
- X /* Create this dialog box */
- X pform =
- X XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
- X
- X
- X /* Create widgets in the box
- X Each has coordinates specified by either XtNfromHoriz and XtNfromVert
- X or XtNhorizDistance and XtNvertDistance
- X arg[1] sets horizontal position, arg[2] sets vertical
- X Each has a callback if appropriate
- X */
- X
- X
- X twidge1 =
- X XtCreateManagedWidget("Specify Type of chart (press button)",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X
- X /* set type */
- X callback[0].callback = type_select;
- X callback[0].closure = (caddr_t) "chart_type";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X NButton_args = 3;
- X twidge2 =
- X XtCreateManagedWidget(
- X ((chart_type == THREEPART) ?
- X "Main Map plus Thumbnail" :
- X "Full Page "),
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X
- X
- X
- X callback[0].callback = do_dismiss;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X callback[0].callback = do_cancel;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNfromHoriz, dismiss_widge);
- X cancel_widge =
- X XtCreateManagedWidget( "Cancel ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X
- X /* Save the current values */
- X TypeD.chart_type = chart_type;
- X
- X current_dialog = TypeDialog;
- X XtPopup(pwidg, XtGrabNonexclusive);
- X type_help();
- X}
- X
- X/********** Dialog ***************/
- X/* Magnitudes dialog
- X Set lbllim, maglim, gklim
- X*/
- X
- Xvoid Magnitudes(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X Widget pshell, pwidg, pform;
- X static Arg shell_args[] = {
- X { XtNwidth, (XtArgVal) 100},
- X };
- X char *dlog_name = "magnitudes";
- X Arg Button_arg[10], Label_arg[10];
- X Cardinal NButton_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
- X
- X XtSetArg( Button_arg[0], XtNcallback, callback );
- X NButton_args = 1;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg( Label_arg[0], XtNborderWidth, 0);
- X XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
- X NLabel_args = 2;
- X
- X
- X /* Create shell and shell widget */
- X pshell = XtCreatePopupShell(dlog_name,
- X topLevelShellWidgetClass,
- X widget, shell_args, XtNumber(shell_args));
- X pwidg =
- X XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
- X
- X /* Create this dialog box */
- X pform =
- X XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
- X
- X
- X /* Create widgets in the box
- X Each has coordinates specified by either XtNfromHoriz and XtNfromVert
- X or XtNhorizDistance and XtNvertDistance
- X arg[1] sets horizontal position, arg[2] sets vertical
- X Each has a callback if appropriate
- X */
- X
- X
- X twidge1 =
- X XtCreateManagedWidget("Specify Magnitude limits for",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X
- X /* Get name limit (lbllim) */
- X MagnitudesD.all_lbllim_wid =
- X twidge2 = Get_float("Object names: ", twidge1, pform, all_lbllim,
- X MagnitudesD.all_lbllim_str,
- X sizeof(MagnitudesD.all_lbllim_str));
- X twidge1 = twidge2;
- X
- X /* Get label limit (gklim) */
- X MagnitudesD.all_gklim_wid =
- X twidge2 = Get_float("Bayer labels: ", twidge1, pform, all_gklim,
- X MagnitudesD.all_gklim_str,
- X sizeof(MagnitudesD.all_gklim_str));
- X twidge1 = twidge2;
- X
- X /* Get visibility limit (maglim) */
- X MagnitudesD.all_maglim_wid =
- X twidge2 = Get_float("Object symbol: ", twidge1, pform, all_maglim,
- X MagnitudesD.all_maglim_str,
- X sizeof(MagnitudesD.all_maglim_str));
- X twidge1 = twidge2;
- X
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X
- X
- X
- X callback[0].callback = mag_apply;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X NButton_args = 3;
- X apply_widge =
- X XtCreateManagedWidget( " Apply ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X bottom_widge = apply_widge;
- X
- X callback[0].callback = do_dismiss;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X callback[0].callback = do_cancel;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNfromHoriz, dismiss_widge);
- X cancel_widge =
- X XtCreateManagedWidget( "Cancel ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X
- X /* Save the current values */
- X MagnitudesD.all_lbllim = all_lbllim;
- X MagnitudesD.all_maglim = all_maglim;
- X MagnitudesD.all_gklim = all_gklim;
- X
- X current_dialog = MagnitudesDialog;
- X XtPopup(pwidg, XtGrabNonexclusive);
- X magnitudes_help();
- X}
- X
- X/********** Dialog ***************/
- X/* Layers dialog
- X Set all_layer
- X*/
- X
- Xvoid Layers(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X Widget pshell, pwidg, pform;
- X static Arg shell_args[] = {
- X { XtNwidth, (XtArgVal) 100},
- X };
- X char *dlog_name = "layers";
- X void layer_select();
- X Arg Button_arg[10], Label_arg[10];
- X Cardinal NButton_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, apply_widge, dismiss_widge, cancel_widge;
- X int i;
- X char *cp;
- X
- X
- X XtSetArg( Button_arg[0], XtNcallback, callback );
- X NButton_args = 1;
- X
- X /* Labels should be left justified, and not have borders */
- X XtSetArg( Label_arg[0], XtNborderWidth, 0);
- X XtSetArg( Label_arg[1], XtNjustify, XtJustifyLeft);
- X NLabel_args = 2;
- X
- X
- X /* Create shell and shell widget */
- X pshell = XtCreatePopupShell(dlog_name,
- X topLevelShellWidgetClass,
- X widget, shell_args, XtNumber(shell_args));
- X pwidg =
- X XtCreateManagedWidget(dlog_name, shellWidgetClass, pshell, NULL, 0);
- X
- X /* Create this dialog box */
- X pform =
- X XtCreateManagedWidget(dlog_name, formWidgetClass, pwidg, NULL, 0);
- X
- X
- X /* Create widgets in the box
- X Each has coordinates specified by either XtNfromHoriz and XtNfromVert
- X or XtNhorizDistance and XtNvertDistance
- X arg[1] sets horizontal position, arg[2] sets vertical
- X Each has a callback if appropriate
- X */
- X
- X
- X twidge1 =
- X XtCreateManagedWidget("Specify Layer drawing order",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X
- X for (i = 0; i < MAXLAYRS; i++) {
- X LayersD.laynum[i] = i;
- X
- X callback[0].callback = layer_select;
- X callback[0].closure = (caddr_t) ((int *) &(LayersD.laynum[i]));
- X XtSetArg(Button_arg[0], XtNcallback, callback);
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X
- X NButton_args = 3;
- X cp = lay_strings[all_layer[i]];
- X LayersD.wid[i] =
- X twidge2 =
- X XtCreateManagedWidget(cp,
- X commandWidgetClass, pform,
- X Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X }
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X
- X callback[0].callback = layers_apply;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X NButton_args = 3;
- X apply_widge =
- X XtCreateManagedWidget( " Apply ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X bottom_widge = apply_widge;
- X
- X callback[0].callback = do_dismiss;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[0], XtNcallback, callback);
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X callback[0].callback = do_cancel;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNfromHoriz, dismiss_widge);
- X cancel_widge =
- X XtCreateManagedWidget( "Cancel ",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X
- X /* Save the current values */
- X for (i = 0; i < MAXLAYRS; i++)
- END_OF_FILE
- if test 31360 -ne `wc -c <'starchart/sXawD.c.aa'`; then
- echo shar: \"'starchart/sXawD.c.aa'\" unpacked with wrong size!
- fi
- # end of 'starchart/sXawD.c.aa'
- fi
- echo shar: End of archive 20 \(of 32\).
- cp /dev/null ark20isdone
- MISSING=""
- 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
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 32 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-
-