home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-06 | 50.3 KB | 1,764 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 32 (of 32)."
- # Contents: starchart/starXawMwin.c
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'starchart/starXawMwin.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'starchart/starXawMwin.c'\"
- else
- echo shar: Extracting \"'starchart/starXawMwin.c'\" \(47939 characters\)
- sed "s/^X//" >'starchart/starXawMwin.c' <<'END_OF_FILE'
- X/*
- X * Mapwin edit dialogs for starXaw
- 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
- X
- Xstatic char rcsid[]="$Header: starXawMwin.c,v 1.7 90/03/10 15:34:13 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
- 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 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
- X#define READ_MAPWIN 1
- X#define WRITE_MAPWIN 2
- X#define NO_MAPWIN 0
- 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 use_x_dashes;
- Xextern Bool is_color; /* Is it color? */
- Xextern Bool is_super_color; /* Is it many color? */
- X
- X
- X
- Xextern Bool edit_mapwins;
- X
- X
- X/* From starXaw */
- Xextern Widget interface;
- Xextern XtTranslations numbers_oneline, string_oneline;
- Xextern Bool fixed_win_coo;
- X
- X
- X/* From starXawDlog */
- XWidget Get_float();
- XWidget Get_string();
- XWidget Get_int();
- Xvoid do_dismiss();
- Xvoid update_string();
- Xextern char *lay_strings[], *filetype_strings[];
- X#define MAXLAYNUM 14
- X#define MAXFTYPES 6
- X
- X/* Local */
- Xstatic Bool done_mapwin = False;
- Xstatic int editting_mapwin = 0;
- Xstatic int num_initted_mapwins; /* Number of mapwins which have
- X been initialized */
- X
- Xstatic char *loc_proj_mode_strings[] = {
- X "Error",
- X "Sansons",
- X "Stereographic",
- X "Gnomonic",
- X "Orthographic",
- X "Rectangular",
- X};
- X#define MAXPMODE 5
- X
- X
- Xstatic int curr_file;
- X
- Xstatic char numwin_str[6];
- Xstatic Widget numwin_wid;
- X/* edit_struct */
- Xstatic char width_str[6], height_str[6], x_off_str[6], y_off_str[6];
- Xstatic char ra_str[12], de_str[12], sc_str[12];
- Xstatic char ra_step_str[12], de_step_str[12], ra_strt_str[12], de_strt_str[12];
- X
- Xstatic char stru_num_str[80];
- Xstatic Widget stru_num_wid, next_map_wid, prev_map_wid;
- Xstatic char file_num_str[80];
- Xstatic Widget file_num_wid, next_file_wid, prev_file_wid;
- Xstatic Widget width_wid, height_wid, x_off_wid, y_off_wid;
- Xstatic Widget ra_wid, de_wid, sc_wid;
- Xstatic Widget ra_step_wid, de_step_wid, ra_strt_wid, de_strt_wid;
- Xstatic Widget fix_win_wid, inv_wid, pmode_wid, draw_ra_wid, draw_dec_wid;
- X
- Xstatic Widget layers_wid[MAXLAYRS];
- Xstatic int laynum[MAXLAYRS];
- X
- Xstatic char numfiles_str[6];
- Xstatic Widget numfiles_wid;
- X
- Xstatic char f_maglim_str[12], f_lbllim_str[12], f_gklim_str[12];
- Xstatic char f_vmin_str[12], f_vmax_str[12];
- Xstatic char file_name_str[MAXPATHLEN];
- Xstatic Widget file_name_wid, f_type_wid;
- Xstatic Widget f_maglim_wid, f_lbllim_wid, f_gklim_wid;
- Xstatic Widget f_vmin_wid, f_vmax_wid, f_dmaglbl_wid;
- X
- X
- Xvoid done_in(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X done_mapwin = True;
- X
- X XtPopdown((Widget) closure);
- X un_help();
- X}
- X
- Xvoid do_win_dismiss(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X win_apply();
- X
- X XtPopdown((Widget) closure);
- X/* un_help();*/
- X mwinin_help();
- X}
- X
- X
- Xvoid do_file_dismiss(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X file_apply();
- X
- X XtPopdown((Widget) closure);
- X/* un_help();*/
- X estru_help();
- X}
- X
- Xvoid do_lay_dismiss(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X
- X XtPopdown((Widget) closure);
- X/* un_help();*/
- X estru_help();
- X}
- X
- X
- Xvoid next_map(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X win_apply();
- X
- X editting_mapwin++;
- X
- X win_reset(closure);
- X/* XtPopdown((Widget) closure);*/
- X}
- X
- Xvoid prev_map(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X win_apply();
- X
- X editting_mapwin--;
- X
- X win_reset(closure);
- X/* XtPopdown((Widget) closure);*/
- X}
- X
- Xvoid nothing_map(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X}
- X
- X
- Xvoid next_file(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X file_apply();
- X curr_file++;
- X file_reset(closure);
- X/* XtPopdown((Widget) closure);*/
- X}
- X
- Xvoid prev_file(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X file_apply();
- X curr_file--;
- X file_reset(closure);
- X/* XtPopdown((Widget) closure);*/
- X}
- X
- Xvoid nothing_file(widget,closure,callData)
- X Widget widget;
- X caddr_t closure; /* Widget */
- X caddr_t callData;
- X{
- X}
- X
- X
- Xvoid fixed_coo_toggle(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X
- X fixed_win_coo = !fixed_win_coo;
- X
- X XtSetArg( args[0], XtNlabel, fixed_win_coo ?
- X "Use these settings":
- X "Allow X to set size");
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid invert_win_toggle(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X
- X mapwin[editting_mapwin]->invert =
- X !mapwin[editting_mapwin]->invert;
- X
- X XtSetArg( args[0], XtNlabel,
- X mapwin[editting_mapwin]->invert?
- X "Inverted": "Normal");
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid win_pmode_select(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X char *cp;
- X
- X mapwin[editting_mapwin]->proj_mode++;
- X mapwin[editting_mapwin]->proj_mode %= (MAXPMODE+1);
- X if (mapwin[editting_mapwin]->proj_mode == 0)
- X mapwin[editting_mapwin]->proj_mode = 1;
- X
- X cp = loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode];
- X XtSetArg( args[0], XtNlabel, cp);
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid draw_ra_grid_toggle(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X
- X mapwin[editting_mapwin]->draw_ragrid = !mapwin[editting_mapwin]->draw_ragrid;
- X
- X XtSetArg( args[0], XtNlabel, mapwin[editting_mapwin]->draw_ragrid ?
- X "Show R.A. grid":
- X "No R.A. grid");
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid draw_dec_grid_toggle(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X
- X mapwin[editting_mapwin]->draw_decgrid
- X = !mapwin[editting_mapwin]->draw_decgrid;
- X
- X XtSetArg( args[0], XtNlabel, mapwin[editting_mapwin]->draw_decgrid ?
- X "Show Dec. grid":
- X "No Dec. grid");
- X
- X no_dec_grid = !no_dec_grid;
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid draw_maglbl_toggle(widget,namestr,callData)
- X Widget widget;
- X caddr_t namestr;
- X caddr_t callData;
- X{
- X Arg args[1];
- X
- X mapwin[editting_mapwin]->file[curr_file].draw_maglbl =
- X !mapwin[editting_mapwin]->file[curr_file].draw_maglbl;
- X
- X XtSetArg(args[0], XtNlabel,
- X mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
- X "Label stars with their magnitudes ":
- X "Don't Label stars with their magnitudes");
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- X
- XD_mapwininput()
- X{
- X int i;
- X Widget pshell, pwidg, pform;
- X static Arg shell_args[] = {
- X { XtNwidth, (XtArgVal) 100},
- X };
- X char *dlog_name = "mapwininput";
- 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;
- X void edit_structs();
- X
- X /* First do final customization of the mapwin */
- X /* This is necessary because fix_mapwin() in starcust.c,
- X and the code in main() is not quite appropriate for undoing things set
- X interactively */
- X for (i = 0; i < numwins; i++) {
- X if (!all_invert && mapwin[i]->invert) mapwin[i]->invert = FALSE;
- X }
- X
- X if (edit_mapwins) {
- X num_initted_mapwins = numwins;
- 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 interface, 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("Edit mapwindow structures",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X
- X numwin_wid =
- X twidge2 =
- X Get_int("Number of window structures:",
- X twidge1, pform, numwins, numwin_str, sizeof(numwin_str));
- X twidge1 = twidge2;
- X
- X callback[0].callback = edit_structs;
- X callback[0].closure = (caddr_t)pwidg;
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X NButton_args = 3;
- X twidge2 =
- X XtCreateManagedWidget( "edit struct",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X callback[0].callback = done_in;
- 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 dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X /* Save the current values */
- X XtPopup(pwidg, XtGrabNonexclusive);
- X mwinin_help();
- X done_mapwin = FALSE;
- X while (!done_mapwin) {
- X XtNextEvent(&event);
- X XtDispatchEvent(&event);
- X };
- X };
- X}
- X
- X
- X/* edit structures */
- Xvoid edit_structs(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 = "edit structs";
- X Arg Button_arg[10], Text_arg[10], Label_arg[10];
- X Cardinal NButton_args, NText_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X static XtCallbackRec next_callback[3], prev_callback[3];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, dismiss_widge;
- X int i;
- X char *cp;
- X void edit_layers();
- X void edit_files();
- 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 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 /* convert numwin_str to numwins */
- X numwins = atoi(numwin_str);
- X if (numwins > MAXWINDOWS) {
- X numwins = MAXWINDOWS;
- X sprintf(numwin_str, "%d", numwins);
- X update_string(numwin_wid, numwin_str);
- X }
- X
- X /* Set curr_file to zero for each new mapwindow */
- X curr_file = 0;
- X
- X
- X /* Create shell and shell widget */
- X if (editting_mapwin >= num_initted_mapwins)
- X init_mapwin(editting_mapwin);
- X
- X /* Must make sure that there is a file name */
- X for (i = 0; i < MAXMAPFILES; i++) {
- X if (mapwin[editting_mapwin]->file[i].name == NULL)
- X mapwin[editting_mapwin]->file[i].name = "";
- X if (mapwin[editting_mapwin]->file[i].type == 0)
- X mapwin[editting_mapwin]->file[i].type = LINEREAD;
- X }
- X
- X XtSetArg(Text_arg[0], XtNlength, sizeof(stru_num_str));
- X XtSetArg(Text_arg[1], XtNstring, stru_num_str);
- X XtSetArg(Text_arg[2], XtNwidth, 208);
- X XtSetArg(Text_arg[3], XtNborderWidth, 0);
- X NText_args = 4;
- X sprintf(stru_num_str, "Structure number %d", editting_mapwin+1);
- X stru_num_wid =
- X twidge2 =
- X XtCreateManagedWidget(stru_num_str,
- X asciiStringWidgetClass, pform,
- X Text_arg, NText_args);
- X twidge1 = twidge2;
- X
- X
- X width_wid =
- X twidge2 =
- X Get_int("Width: ",
- X twidge1, pform,
- X mapwin[editting_mapwin]->width, width_str, sizeof(width_str));
- X twidge1 = twidge2;
- X
- X height_wid =
- X twidge2 =
- X Get_int("Height: ",
- X twidge1, pform,
- X mapwin[editting_mapwin]->height, height_str, sizeof(height_str));
- X twidge1 = twidge2;
- X
- X x_off_wid =
- X twidge2 =
- X Get_int("X offset: ",
- X twidge1, pform,
- X mapwin[editting_mapwin]->x_offset, x_off_str, sizeof(x_off_str));
- X twidge1 = twidge2;
- X
- X y_off_wid =
- X twidge2 =
- X Get_int("Y offset: ",
- X twidge1, pform,
- X mapwin[editting_mapwin]->y_offset, y_off_str, sizeof(y_off_str));
- X twidge1 = twidge2;
- X
- X /* Fixed window coordinates */
- X callback[0].callback = fixed_coo_toggle;
- X callback[0].closure = (caddr_t) "fixwin";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X XtSetArg(Button_arg[3], XtNwidth, 208);
- X NButton_args = 4;
- X
- X fix_win_wid =
- X twidge2 =
- X XtCreateManagedWidget(fixed_win_coo ?
- X "Use these settings":
- X "Allow X to set size",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X
- X /* get RA */
- X ra_wid =
- X twidge2 = Get_float("Right Asc.: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->racen/15.0),
- X ra_str,
- X sizeof(ra_str));
- X twidge1 = twidge2;
- X
- X /* get DEC */
- X de_wid =
- X twidge2 = Get_float("Declination: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->dlcen),
- X de_str,
- X sizeof(de_str));
- X twidge1 = twidge2;
- X
- X /* Get Scale */
- X sc_wid =
- X twidge2 = Get_float("Scale: ", twidge1, pform,
- X mapwin[editting_mapwin]->scale,
- X sc_str,
- X sizeof(sc_str));
- X twidge1 = twidge2;
- X
- X /* Toggle invert */
- X callback[0].callback = invert_win_toggle;
- X callback[0].closure = (caddr_t) "Invert";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X XtSetArg(Button_arg[3], XtNwidth, 208);
- X NButton_args = 4;
- X inv_wid =
- X twidge2 =
- X XtCreateManagedWidget(mapwin[editting_mapwin]->invert?
- X "Inverted": "Normal",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X /* Projection mode */
- X callback[0].callback = win_pmode_select;
- X callback[0].closure = (caddr_t) "projection_mode";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X
- X cp = loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode];
- X
- X pmode_wid =
- X twidge2 =
- X XtCreateManagedWidget(cp,
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X/* twidge1 =
- X XtCreateManagedWidget("Specify Grid",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X*/
- X
- X if (mapwin[editting_mapwin]->ra_step == 0)
- X mapwin[editting_mapwin]->ra_step = 15.0;
- X if (mapwin[editting_mapwin]->dec_step == 0)
- X mapwin[editting_mapwin]->dec_step = 5.0;
- X
- X /* Get ra_step */
- X ra_step_wid =
- X twidge2 = Get_float("R.A. Step: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->ra_step/15.0),
- X ra_step_str,
- X sizeof(ra_step_str));
- X twidge1 = twidge2;
- X
- X /* Get dec_step */
- X de_step_wid =
- X twidge2 = Get_float("Dec. Step: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->dec_step),
- X de_step_str,
- X sizeof(de_step_str));
- X twidge1 = twidge2;
- X
- X
- X /* Get ra_strt */
- X ra_strt_wid =
- X twidge2 = Get_float("R.A. Start: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->ra_strt/15.0),
- X ra_strt_str,
- X sizeof(ra_strt_str));
- X twidge1 = twidge2;
- X
- X /* Get dec_strt */
- X de_strt_wid =
- X twidge2 = Get_float("Dec. Start: ", twidge1, pform,
- X dtof(mapwin[editting_mapwin]->dec_strt),
- X de_strt_str,
- X sizeof(de_strt_str));
- X twidge1 = twidge2;
- X
- X
- X /* Toggle ra */
- X callback[0].callback = draw_ra_grid_toggle;
- X callback[0].closure = (caddr_t) "draw_ra_grid";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X draw_ra_wid =
- X twidge2 =
- X XtCreateManagedWidget(mapwin[editting_mapwin]->draw_ragrid ?
- X "Show R.A. grid":
- X "No R.A. grid",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X /* Toggle dec */
- X callback[0].callback = draw_dec_grid_toggle;
- X callback[0].closure = (caddr_t) "draw_dec_grid";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X draw_dec_wid =
- X twidge2 =
- X XtCreateManagedWidget(mapwin[editting_mapwin]->draw_decgrid ?
- X "Show Dec. grid":
- X "No Dec. grid",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X
- X
- X callback[0].callback = edit_layers;
- 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, twidge1);
- X XtSetArg(Button_arg[3], XtNwidth, 208);
- X NButton_args = 4;
- X twidge2 =
- X XtCreateManagedWidget( "Edit Layers",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X numfiles_wid =
- X twidge2 =
- X Get_int("Number of files:",
- X twidge1, pform, mapwin[editting_mapwin]->numfiles,
- X numfiles_str, sizeof(numfiles_str));
- X twidge1 = twidge2;
- X
- X callback[0].callback = edit_files;
- 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, twidge1);
- X twidge2 =
- X XtCreateManagedWidget( "Edit Files",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X if (editting_mapwin < (numwins-1)) {
- X next_callback[0].callback = next_map;
- X next_callback[0].closure = (caddr_t)pwidg;
- X/*
- X next_callback[1].callback = edit_structs;
- X next_callback[1].closure = closure;
- X*/
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "Next";
- X } else {
- X next_callback[0].callback = nothing_map;
- X next_callback[0].closure = (caddr_t)pwidg;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "No Next";
- X }
- X XtSetArg(Button_arg[0], XtNcallback, next_callback);
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X XtSetArg(Button_arg[3], XtNwidth, 101);
- X next_map_wid =
- X twidge2 =
- X XtCreateManagedWidget(cp,
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X
- X if (editting_mapwin > 0) {
- X prev_callback[0].callback = prev_map;
- X prev_callback[0].closure = (caddr_t)pwidg;
- X/*
- X prev_callback[1].callback = edit_structs;
- X prev_callback[1].closure = closure;
- X*/
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "Prev";
- X } else {
- X prev_callback[0].callback = nothing_map;
- X prev_callback[0].closure = (caddr_t)pwidg;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "No Prev";
- X }
- X XtSetArg(Button_arg[0], XtNcallback, prev_callback);
- X XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X prev_map_wid =
- X twidge2 =
- X XtCreateManagedWidget( cp,
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X callback[0].callback = do_win_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 XtSetArg(Button_arg[3], XtNwidth, 208);
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X XtPopup(pwidg, XtGrabExclusive);
- X estru_help();
- X}
- X
- Xinit_mapwin(win_no)
- Xint win_no;
- X{
- X int i;
- X
- X mapwin[win_no] = (mapwindow *) malloc((unsigned) sizeof(mapwindow));
- X /* Copy the values from mapwin[0] to this mapwin */
- X
- X mapwin[win_no]->width = mapwin[0]->width;
- X mapwin[win_no]->height = mapwin[0]->height;
- X mapwin[win_no]->x_offset = mapwin[0]->x_offset;
- X mapwin[win_no]->y_offset = mapwin[0]->y_offset;
- X
- X mapwin[win_no]->maglim = mapwin[0]->maglim;
- X mapwin[win_no]->lbllim = mapwin[0]->lbllim;
- X mapwin[win_no]->gklim = mapwin[0]->gklim;
- X
- X
- X mapwin[win_no]->map_type = mapwin[0]->map_type;
- X mapwin[win_no]->tag = mapwin[0]->tag;
- X mapwin[win_no]->tag_field = mapwin[0]->tag_field;
- X
- X mapwin[win_no]->proj_mode = mapwin[0]->proj_mode;
- X mapwin[win_no]->draw_ragrid = mapwin[0]->draw_ragrid;
- X mapwin[win_no]->draw_decgrid = mapwin[0]->draw_decgrid;
- X mapwin[win_no]->ra_step = mapwin[0]->ra_step;
- X mapwin[win_no]->dec_step = mapwin[0]->dec_step;
- X mapwin[win_no]->ra_strt = mapwin[0]->ra_strt;
- X mapwin[win_no]->dec_strt = mapwin[0]->dec_strt;
- X
- X mapwin[win_no]->invert = mapwin[0]->invert;
- X
- X mapwin[win_no]->racen = mapwin[0]->racen;
- X mapwin[win_no]->dlcen = mapwin[0]->dlcen;
- X mapwin[win_no]->scale = mapwin[0]->scale;
- X
- X mapwin[win_no]->c_scale = mapwin[0]->c_scale;
- X for (i = 0; i < MAXLAYRS; i++)
- X mapwin[win_no]->layer[i] = mapwin[0]->layer[i];
- X mapwin[win_no]->nlayers = mapwin[0]->nlayers;
- X
- X for (i = 0; i < MAXMAPFILES; i++) {
- X if (mapwin[0]->file[i].name != NULL)
- X mapwin[win_no]->file[i].name = mapwin[0]->file[i].name;
- X else
- X mapwin[win_no]->file[i].name = "";
- X mapwin[win_no]->file[i].type = mapwin[0]->file[i].type;
- X mapwin[win_no]->file[i].maglim = mapwin[0]->file[i].maglim;
- X mapwin[win_no]->file[i].lbllim = mapwin[0]->file[i].lbllim;
- X mapwin[win_no]->file[i].gklim = mapwin[0]->file[i].gklim;
- X
- X mapwin[win_no]->file[i].draw_maglbl = mapwin[0]->file[i].draw_maglbl;
- X mapwin[win_no]->file[i].maglmin = mapwin[0]->file[i].maglmin;
- X mapwin[win_no]->file[i].maglmax = mapwin[0]->file[i].maglmax;
- X }
- X
- X mapwin[win_no]->numfiles = mapwin[0]->numfiles;
- X
- X num_initted_mapwins = win_no+1;
- X}
- X
- X
- X/********** Dialog ***************/
- X/* Layers dialog
- X Set mapwin[editting_mapwin].layer
- X*/
- X
- Xvoid edit_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;
- X int i;
- X char *cp;
- X void mlayer_select();
- X void mlayers_apply();
- 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 laynum[i] = i;
- X
- X callback[0].callback = mlayer_select;
- X callback[0].closure = (caddr_t) ((int *) &(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[mapwin[editting_mapwin]->layer[i]];
- X layers_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 = mlayers_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_lay_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 /* Save the current values */
- X XtPopup(pwidg, XtGrabExclusive);
- X elay_help();
- X}
- X
- Xvoid mlayer_select(widget, laynump, callData)
- X Widget widget;
- X caddr_t laynump;
- X caddr_t callData;
- X{
- X Arg args[1];
- X char *cp;
- X int i;
- X
- X i = *((int* ) laynump);
- X
- X mapwin[editting_mapwin]->layer[i]++;
- X mapwin[editting_mapwin]->layer[i] %= (MAXLAYNUM+1);
- X
- X cp = lay_strings[mapwin[editting_mapwin]->layer[i]];
- X XtSetArg( args[0], XtNlabel, cp);
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- Xvoid mlayers_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 (mapwin[editting_mapwin]->layer[i] != 0)
- X mapwin[editting_mapwin]->layer[nlayers++]
- X = mapwin[editting_mapwin]->layer[i];
- X for (i = nlayers;i < MAXLAYRS; i++) mapwin[editting_mapwin]->layer[i] = 0;
- X mapwin[editting_mapwin]->nlayers = nlayers;
- X
- X for (i = 0; i < MAXLAYRS; i++) {
- X cp = lay_strings[mapwin[editting_mapwin]->layer[i]];
- X XtSetArg(args[0], XtNlabel, cp);
- X
- X XtSetValues(layers_wid[i], args, (Cardinal)1);
- X }
- X}
- X
- Xvoid ftype_win_select(widget, mapnump, callData)
- X Widget widget;
- X caddr_t mapnump;
- X caddr_t callData;
- X{
- X Arg args[1];
- X char *cp;
- X
- X mapwin[editting_mapwin]->file[curr_file].type++;
- X mapwin[editting_mapwin]->file[curr_file].type %= (MAXFTYPES+1);
- X if (mapwin[editting_mapwin]->file[curr_file].type == 0)
- X mapwin[editting_mapwin]->file[curr_file].type = 1;
- X
- X cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
- X XtSetArg( args[0], XtNlabel, cp);
- X
- X XtSetValues(widget, args, (Cardinal)1);
- X}
- X
- X
- X
- X/* edit file structures */
- Xvoid edit_files(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 = "edit files";
- X Arg Button_arg[10], Text_arg[10], Label_arg[10];
- X Cardinal NButton_args, NText_args, NLabel_args;
- X static XtCallbackRec callback[2];
- X static XtCallbackRec next_callback[3], prev_callback[3];
- X Widget twidge1, twidge2;
- X Widget bottom_widge, higher_widge, dismiss_widge;
- X char *cp;
- X int i;
- 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 /* 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 /* convert numfiles_str to numfiles */
- X i = atoi(numfiles_str);
- X if (i > MAXMAPFILES) {
- X i = MAXMAPFILES;
- X sprintf(numfiles_str, "%d", i);
- X update_string(numfiles_wid, numfiles_str);
- X }
- X mapwin[editting_mapwin]->numfiles = i;
- X
- X
- X XtSetArg(Text_arg[0], XtNlength, sizeof(file_num_str));
- X XtSetArg(Text_arg[1], XtNstring, file_num_str);
- X XtSetArg(Text_arg[2], XtNwidth, 200);
- X XtSetArg(Text_arg[3], XtNborderWidth, 0);
- X NText_args = 4;
- X sprintf(file_num_str, "File number %d", curr_file+1);
- X file_num_wid =
- X twidge2 =
- X XtCreateManagedWidget(file_num_str,
- X asciiStringWidgetClass, pform,
- X Text_arg, NText_args);
- X
- X twidge1 = twidge2;
- X
- X higher_widge = twidge1;
- X /* File name and type */
- X strcpy(file_name_str, mapwin[editting_mapwin]->file[curr_file].name);
- X
- X
- X file_name_wid =
- X twidge2 = Get_string("File:", twidge1, pform,
- X file_name_str,
- X MAXPATHLEN, 300, 300);
- X twidge1 = twidge2;
- X
- X
- X XtSetArg(Label_arg[2], XtNfromHoriz, twidge1);
- X XtSetArg(Label_arg[3], XtNfromVert, higher_widge);
- X NLabel_args = 4;
- X
- X twidge2 =
- X XtCreateManagedWidget(" Type:",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X twidge1 = twidge2;
- X
- X callback[0].callback = ftype_win_select;
- X callback[0].closure = (caddr_t) "fwin";
- X XtSetArg(Button_arg[0], XtNcallback, callback);
- X XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
- X XtSetArg(Button_arg[2], XtNfromVert, higher_widge);
- X
- X NButton_args = 3;
- X cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
- X f_type_wid =
- X twidge2 =
- X XtCreateManagedWidget(cp,
- X commandWidgetClass, pform,
- X Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X /* Magnitudes */
- X /* Get name limit (lbllim) */
- X XtSetArg(Label_arg[2], XtNfromVert, twidge1);
- X NLabel_args = 3;
- X
- X twidge2 =
- X XtCreateManagedWidget("Magnitude limits:",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X twidge1 = twidge2;
- X
- X f_lbllim_wid =
- X twidge2 = Get_float("Object names: ", twidge1, pform,
- X mapwin[editting_mapwin]->file[curr_file].lbllim,
- X f_lbllim_str,
- X sizeof(f_lbllim_str));
- X twidge1 = twidge2;
- X
- X /* Get label limit (gklim) */
- X f_gklim_wid =
- X twidge2 = Get_float("Bayer labels: ", twidge1, pform,
- X mapwin[editting_mapwin]->file[curr_file].gklim,
- X f_gklim_str,
- X sizeof(f_gklim_str));
- X twidge1 = twidge2;
- X
- X /* Get visibility limit (maglim) */
- X f_maglim_wid =
- X twidge2 = Get_float("Object symbol: ", twidge1, pform,
- X mapwin[editting_mapwin]->file[curr_file].maglim,
- X f_maglim_str,
- X sizeof(f_maglim_str));
- X twidge1 = twidge2;
- X
- X
- X XtSetArg(Label_arg[2], XtNfromVert, twidge1);
- X NLabel_args = 3;
- X twidge2 =
- X XtCreateManagedWidget("Star magnitude labeling:",
- X labelWidgetClass, pform,
- X Label_arg, NLabel_args);
- X twidge1 = twidge2;
- X
- X f_vmin_wid =
- X twidge2 = Get_float("Brightest: ", twidge1, pform,
- X mapwin[editting_mapwin]->file[curr_file].maglmin,
- X f_vmin_str,
- X sizeof(f_vmin_str));
- X twidge1 = twidge2;
- X
- X /* Get maximum */
- X f_vmax_wid =
- X twidge2 = Get_float("Faintest: ", twidge1, pform,
- X mapwin[editting_mapwin]->file[curr_file].maglmax,
- X f_vmax_str,
- X sizeof(f_vmax_str));
- X twidge1 = twidge2;
- X
- X
- X /* Toggle nomaglabls */
- X callback[0].callback = draw_maglbl_toggle;
- X callback[0].closure = (caddr_t) "draw mablbls";
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, twidge1);
- X NButton_args = 3;
- X
- X f_dmaglbl_wid =
- X twidge2 =
- X XtCreateManagedWidget(
- X mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
- X "Label stars with their magnitudes ":
- X "Don't Label stars with their magnitudes",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X twidge1 = twidge2;
- X
- X
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X if (curr_file < (mapwin[editting_mapwin]->numfiles-1)) {
- X next_callback[0].callback = next_file;
- X next_callback[0].closure = (caddr_t)pwidg;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X/*
- X next_callback[1].callback = edit_files;
- X next_callback[1].closure = closure;
- X*/
- X cp = " Next";
- X } else {
- X next_callback[0].callback = nothing_file;
- X next_callback[0].closure = (caddr_t)pwidg;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "No Next";
- X }
- X XtSetArg(Button_arg[0], XtNcallback, next_callback);
- X XtSetArg(Button_arg[1], XtNhorizDistance, 4);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X NButton_args = 3;
- X next_file_wid =
- X twidge2 =
- X XtCreateManagedWidget(cp,
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X
- X if (curr_file > 0) {
- X prev_callback[0].callback = prev_file;
- X prev_callback[0].closure = (caddr_t)pwidg;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X/*
- X prev_callback[1].callback = edit_files;
- X prev_callback[1].closure = closure;
- X*/
- X cp = " Prev";
- X } else {
- X prev_callback[0].callback = nothing_map;
- X prev_callback[0].closure = (caddr_t)pwidg;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "No Prev";
- X }
- X XtSetArg(Button_arg[0], XtNcallback, prev_callback);
- X XtSetArg(Button_arg[1], XtNfromHoriz, twidge1);
- X XtSetArg(Button_arg[2], XtNfromVert, bottom_widge);
- X NButton_args = 3;
- X prev_file_wid =
- X twidge2 =
- X XtCreateManagedWidget( cp,
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X twidge1 = twidge2;
- X
- X bottom_widge = twidge1; /* The bottommost widget so far */
- X
- X
- X callback[0].callback = do_file_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 NButton_args = 3;
- X dismiss_widge =
- X XtCreateManagedWidget( "Dismiss",
- X commandWidgetClass, pform, Button_arg, NButton_args);
- X
- X XtPopup(pwidg, XtGrabExclusive);
- X efiles_help();
- X}
- X
- Xfile_apply()
- X{
- X char *cp;
- X
- X if (strcmp(file_name_str, mapwin[editting_mapwin]->file[curr_file].name))
- X if (cp = (char *) malloc(strlen(file_name_str))) {
- X mapwin[editting_mapwin]->file[curr_file].name = cp;
- X strcpy(cp, file_name_str);
- X }
- X mapwin[editting_mapwin]->file[curr_file].maglim = atof(f_maglim_str);
- X mapwin[editting_mapwin]->file[curr_file].lbllim = atof(f_lbllim_str);
- X mapwin[editting_mapwin]->file[curr_file].gklim = atof(f_gklim_str);
- X mapwin[editting_mapwin]->file[curr_file].maglmin = atof(f_vmin_str);
- X mapwin[editting_mapwin]->file[curr_file].maglmax = atof(f_vmax_str);
- X}
- X
- X
- X
- Xwin_apply()
- X{
- X
- X mapwin[editting_mapwin]->width = atoi(width_str);
- X mapwin[editting_mapwin]->height = atoi(height_str);
- X mapwin[editting_mapwin]->x_offset = atoi(x_off_str);
- X mapwin[editting_mapwin]->y_offset = atoi(y_off_str);
- X mapwin[editting_mapwin]->racen = htod(ra_str)*15.0;
- X mapwin[editting_mapwin]->dlcen = htod(de_str);
- X mapwin[editting_mapwin]->scale = atof(sc_str);
- X
- X mapwin[editting_mapwin]->ra_step = htod(ra_step_str)*15.0;
- X mapwin[editting_mapwin]->dec_step = htod(de_step_str);
- X mapwin[editting_mapwin]->ra_strt = htod(ra_strt_str)*15.0;
- X mapwin[editting_mapwin]->dec_strt = htod(de_strt_str);
- X}
- X
- X
- X/* win_reset must do everything edit_structs does on entry */
- Xwin_reset(closure)
- X caddr_t closure; /* Widget */
- X{
- X Arg Label_arg[10];
- X int i;
- X char *cp;
- X static XtCallbackRec next_callback[3], prev_callback[3];
- X
- X /* convert numwin_str to numwins */
- X numwins = atoi(numwin_str);
- X if (numwins > MAXWINDOWS) {
- X numwins = MAXWINDOWS;
- X sprintf(numwin_str, "%d", numwins);
- X update_string(numwin_wid, numwin_str);
- X }
- X
- X /* Set curr_file to zero for each new mapwindow */
- X curr_file = 0;
- X
- X
- X /* Create shell and shell widget */
- X if (editting_mapwin >= num_initted_mapwins)
- X init_mapwin(editting_mapwin);
- X
- X /* Must make sure that there is a file name */
- X for (i = 0; i < MAXMAPFILES; i++) {
- X if (mapwin[editting_mapwin]->file[i].name == NULL)
- X mapwin[editting_mapwin]->file[i].name = "";
- X if (mapwin[editting_mapwin]->file[i].type == 0)
- X mapwin[editting_mapwin]->file[i].type = LINEREAD;
- X }
- X
- X sprintf(stru_num_str, "Structure number %d", editting_mapwin+1);
- X XtSetArg(Label_arg[0], XtNlabel, stru_num_str);
- X XtSetValues(stru_num_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(stru_num_wid, strlen(stru_num_str));
- X
- X if (editting_mapwin < (numwins-1)) {
- X next_callback[0].callback = next_map;
- X next_callback[0].closure = closure;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "Next";
- X } else {
- X next_callback[0].callback = nothing_map;
- X next_callback[0].closure = closure;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "No Next";
- X }
- X XtSetArg(Label_arg[0], XtNcallback, next_callback);
- X XtSetArg(Label_arg[1], XtNlabel, cp);
- X XtSetValues(next_map_wid, Label_arg, (Cardinal)2);
- X
- X
- X if (editting_mapwin > 0) {
- X prev_callback[0].callback = prev_map;
- X prev_callback[0].closure = closure;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "Prev";
- X } else {
- X prev_callback[0].callback = nothing_map;
- X prev_callback[0].closure = closure;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "No Prev";
- X }
- X XtSetArg(Label_arg[0], XtNcallback, prev_callback);
- X XtSetArg(Label_arg[1], XtNlabel, cp);
- X XtSetValues(prev_map_wid, Label_arg, (Cardinal)2);
- X
- X
- X
- X sprintf(width_str,"%d", mapwin[editting_mapwin]->width);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(width_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(width_wid, strlen(width_str));
- X
- X sprintf(height_str,"%d", mapwin[editting_mapwin]->height);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(height_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(height_wid, strlen(height_str));
- X
- X sprintf(x_off_str,"%d", mapwin[editting_mapwin]->x_offset);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(x_off_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(x_off_wid, strlen(x_off_str));
- X
- X sprintf(y_off_str,"%d", mapwin[editting_mapwin]->y_offset);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(y_off_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(y_off_wid, strlen(y_off_str));
- X
- X XtSetArg(Label_arg[0], XtNlabel, fixed_win_coo ?
- X "Use these settings":
- X "Allow X to set size");
- X XtSetValues(fix_win_wid, Label_arg, (Cardinal)1);
- X
- X sprintf(ra_str, "%.4f", dtof(mapwin[editting_mapwin]->racen/15.0));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(ra_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(ra_wid, strlen(ra_str));
- X
- X sprintf(de_str, "%.4f", dtof(mapwin[editting_mapwin]->dlcen));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(de_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(de_wid, strlen(de_str));
- X
- X sprintf(sc_str, "%.4f", mapwin[editting_mapwin]->scale);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(sc_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(sc_wid, strlen(sc_str));
- X
- X
- X XtSetArg(Label_arg[0], XtNlabel,mapwin[editting_mapwin]->invert?
- X "Inverted": "Normal");
- X XtSetValues(inv_wid, Label_arg, (Cardinal)1);
- X
- X XtSetArg(Label_arg[0], XtNlabel,
- X loc_proj_mode_strings[mapwin[editting_mapwin]->proj_mode]);
- X XtSetValues(pmode_wid, Label_arg, (Cardinal)1);
- X
- X sprintf(ra_step_str, "%.4f", dtof(mapwin[editting_mapwin]->ra_step/15.0));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(ra_step_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(ra_step_wid, strlen(ra_step_str));
- X
- X sprintf(de_step_str, "%.4f", dtof(mapwin[editting_mapwin]->dec_step));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(de_step_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(de_step_wid, strlen(de_step_str));
- X
- X sprintf(ra_strt_str, "%.4f", dtof(mapwin[editting_mapwin]->ra_strt/15.0));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(ra_strt_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(ra_strt_wid, strlen(ra_strt_str));
- X
- X sprintf(de_strt_str, "%.4f", dtof(mapwin[editting_mapwin]->dec_strt));
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(de_strt_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(de_strt_wid, strlen(de_strt_str));
- X
- X
- X XtSetArg(Label_arg[0], XtNlabel, mapwin[editting_mapwin]->draw_ragrid ?
- X "Show R.A. grid":
- X "No R.A. grid");
- X XtSetValues(draw_ra_wid, Label_arg, (Cardinal)1);
- X
- X XtSetArg(Label_arg[0], XtNlabel, mapwin[editting_mapwin]->draw_decgrid ?
- X "Show Dec. grid":
- X "No Dec. grid");
- X XtSetValues(draw_dec_wid, Label_arg, (Cardinal)1);
- X
- X
- X sprintf(numfiles_str,"%d", mapwin[editting_mapwin]->numfiles);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(numfiles_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(numfiles_wid, strlen(numfiles_str));
- X}
- X
- X
- X
- Xfile_reset(closure)
- X caddr_t closure; /* Widget */
- X{
- X Arg Label_arg[10];
- X int i;
- X char *cp;
- X static XtCallbackRec next_callback[3], prev_callback[3];
- X
- X
- X /* convert numfiles_str to numfiles */
- X i = atoi(numfiles_str);
- X if (i > MAXMAPFILES) {
- X i = MAXMAPFILES;
- X sprintf(numfiles_str, "%d", i);
- X update_string(numfiles_wid, numfiles_str);
- X }
- X mapwin[editting_mapwin]->numfiles = i;
- X
- X
- X sprintf(file_num_str, "File number %d", curr_file+1);
- X XtSetArg(Label_arg[0], XtNlabel, file_num_str);
- X XtSetValues(file_num_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(file_num_wid, strlen(file_num_str));
- X
- X if (curr_file < (mapwin[editting_mapwin]->numfiles-1)) {
- X next_callback[0].callback = next_file;
- X next_callback[0].closure = closure;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = " Next";
- X } else {
- X next_callback[0].callback = nothing_file;
- X next_callback[0].closure = closure;
- X next_callback[1].callback = NULL;
- X next_callback[1].closure = NULL;
- X cp = "No Next";
- X }
- X XtSetArg(Label_arg[0], XtNcallback, next_callback);
- X XtSetArg(Label_arg[1], XtNlabel, cp);
- X XtSetValues(next_file_wid, Label_arg, (Cardinal)2);
- X
- X
- X if (curr_file > 0) {
- X prev_callback[0].callback = prev_file;
- X prev_callback[0].closure = closure;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = " Prev";
- X } else {
- X prev_callback[0].callback = nothing_file;
- X prev_callback[0].closure = closure;
- X prev_callback[1].callback = NULL;
- X prev_callback[1].closure = NULL;
- X cp = "No Prev";
- X }
- X XtSetArg(Label_arg[0], XtNcallback, prev_callback);
- X XtSetArg(Label_arg[1], XtNlabel, cp);
- X XtSetValues(prev_file_wid, Label_arg, (Cardinal)2);
- X
- X /* file name string */
- X strcpy(file_name_str, mapwin[editting_mapwin]->file[curr_file].name);
- X update_string(file_name_wid, file_name_str);
- X
- X /* file type toggle */
- X cp = filetype_strings[mapwin[editting_mapwin]->file[curr_file].type];
- X XtSetArg(Label_arg[0], XtNlabel, cp);
- X XtSetValues(f_type_wid, Label_arg, (Cardinal)1);
- X
- X /* mags (floats) */
- X sprintf(f_lbllim_str, "%.4f",
- X mapwin[editting_mapwin]->file[curr_file].lbllim);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(f_lbllim_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(f_lbllim_wid, strlen(f_lbllim_str));
- X
- X sprintf(f_gklim_str, "%.4f",
- X mapwin[editting_mapwin]->file[curr_file].gklim);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(f_gklim_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(f_gklim_wid, strlen(f_gklim_str));
- X
- X sprintf(f_maglim_str, "%.4f",
- X mapwin[editting_mapwin]->file[curr_file].maglim);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(f_maglim_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(f_maglim_wid, strlen(f_maglim_str));
- X
- X /* min and max */
- X sprintf(f_vmin_str, "%.4f",
- X mapwin[editting_mapwin]->file[curr_file].maglmin);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(f_vmin_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(f_vmin_wid, strlen(f_vmin_str));
- X
- X sprintf(f_vmax_str, "%.4f",
- X mapwin[editting_mapwin]->file[curr_file].maglmax);
- X XtSetArg(Label_arg[0], XtNinsertPosition, 0);
- X XtSetValues(f_vmax_wid, Label_arg, (Cardinal)1);
- X XtTextSetLastPos(f_vmax_wid, strlen(f_vmax_str));
- X
- X /* labl toggle */
- X XtSetArg(Label_arg[0], XtNlabel,
- X mapwin[editting_mapwin]->file[curr_file].draw_maglbl ?
- X "Label stars with their magnitudes ":
- X "Don't Label stars with their magnitudes");
- X XtSetValues(f_dmaglbl_wid, Label_arg, (Cardinal)1);
- X}
- END_OF_FILE
- if test 47939 -ne `wc -c <'starchart/starXawMwin.c'`; then
- echo shar: \"'starchart/starXawMwin.c'\" unpacked with wrong size!
- fi
- # end of 'starchart/starXawMwin.c'
- fi
- echo shar: End of archive 32 \(of 32\).
- cp /dev/null ark32isdone
- 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
- cat doc/as.texi.a? > doc/astro.texinfo
- echo "Please rm doc/as.texi.a{a,b}"
- cat doc/as.ms.a? > doc/astro.ms
- echo "Please rm doc/as.ms.a{a,b}"
- cat starchart/sXawD.c.a? > starchart/starXawDlog.c
- echo "Please rm starchart/sXawD.c.a{a,b}"
- cat starchart/spo.c.a? > starchart/starpost.c
- echo "Please rm starchart/spo.c.a{a,b}"
- cat starchart/ssup.c.a? > starchart/starsupp.c
- echo "Please rm starchart/ssup.c.a{a,b}"
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
-
-