home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-06 | 42.5 KB | 1,487 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 29 (of 32)."
- # Contents: starchart/starX11.c
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'starchart/starX11.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'starchart/starX11.c'\"
- else
- echo shar: Extracting \"'starchart/starX11.c'\" \(40722 characters\)
- sed "s/^X//" >'starchart/starX11.c' <<'END_OF_FILE'
- X/*
- X * X11 driver for starchart.c 3.0 mainline 4/17/88
- X *
- X * Driver creates X11 window and draws starchart information inside.
- X * Intially window size is variable, but it stays constant once it's
- X * mapped. It handles expose events, even while it's drawing.
- X * Includes glyphs for variable stars.
- X *
- X *
- X * Portions Copyright (c) 1989 by Joe Wang (joe@athena.mit.edu)
- 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: starX11.c,v 2.16 90/02/19 17:53:06 ccount Exp $";
- X
- X#include <stdio.h>
- X#include <math.h>
- X#include <ctype.h>
- X#include "star3.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/Xlib.h>
- X#include <X11/Xutil.h>
- X
- Xchar *malloc();
- X
- X/* X items */
- XDisplay *display; /* connection to display server */
- Xint screen_num;
- XScreen screen;
- XWindow root, window; /* window to graphics in */
- XDrawable draw_into;
- XColormap default_cmap; /* colormap */
- XGC default_GC; /* graphics context */
- XXFontStruct *default_font; /* default font */
- XXFontStruct *greek_font; /* Greek font */
- XPixmap backup; /* backup for expose events */
- XPixel black, white, foreground, background;
- XPixel *pixels; /* color map cells */
- XPixel *star_pixels; /* color map cells for super color stars */
- Xint ncolors, star_colors;
- XXEvent event; /* event structure */
- XXGCValues values_GC; /* modify GC */
- Xunsigned int width, height;
- X
- XBoolean reverse;
- X
- XBool use_backup = FALSE;
- XBool hide_drawing = FALSE;
- XBool post_preview = FALSE;
- XBool post_landscape = FALSE;
- X#ifdef USE_X_DASHES
- XBool use_x_dashes = TRUE;
- X#else
- XBool use_x_dashes = FALSE;
- X#endif
- XBool is_color = TRUE; /* Is it color? */
- XBool is_super_color = TRUE; /* Is it many color? */
- X
- X
- Xint Xargc = 1;
- Xchar *Xargv[40];
- X
- X
- X
- X#ifdef STARX11
- Xchar prog[] = "StarX11";
- X#else
- Xextern char prog[];
- X#endif
- X
- X#include "icon.h"
- X
- X#define BLACK 0
- X#define WHITE 1
- X#define RED 2
- X#define ORANGE 3
- X#define YELLOW 4
- X#define GREEN 5
- X#define CYAN 6
- X#define BLUE 7
- X#define VIOLET 8
- X#define BLUE_WHITE 9
- X
- X/* Externs */
- Xextern int g_argc;
- Xextern char **g_argv;
- X
- Xextern char *title;
- X
- Xextern mapwindow *mapwin[MAXWINDOWS];
- Xextern int numwins;
- X
- Xextern int cur_function;
- Xextern int cur_map_type;
- Xextern int cur_map_tag;
- Xextern char *cur_tag_field;
- X
- X
- X/* Scale multiplier, minimum,
- X mangitude change, maximum, for thumbnail */
- X#define THSMUL 1.2
- X#define THSMIN 12.0
- X#define THMADJ 2.5
- X#define THMMAX 8.0
- X
- Xmapwindow fullpage = {920, 700, 20, 48,
- X 8.0, 3.0, 2.05, FULLPAGEMAP, 0, "String",
- X SANSONS, FALSE, FALSE, 7.5, 5.0, 0.0, 0.0, FALSE,};
- Xmapwindow mainmap = {920, 480, 20, 268,
- X 8.0, 3.0, 2.05, MAINMAP, 0, "String",
- X SANSONS, FALSE, FALSE, 7.5, 5.0, 0.0, 0.0, FALSE,};
- Xmapwindow thumbmap = {480, 195, 420, 35, 6.2+THMADJ, 1.0+THMADJ, 2.05+THMADJ,
- X THUMBNAIL, 0, "String", SANSONS, FALSE, FALSE, 7.5, 5.0,
- X 0.0, 0.0, FALSE,};
- X
- Xint htick_lim = 2;
- Xint htext_lim = 37;
- Xint htext_xoff = 2;
- Xint htext_yoff = 12;
- Xint vtick_lim = 2;
- Xint vtext_lim = 12;
- Xint vtext_xoff = 16;
- Xint vtext_yoff = 0;
- X
- X/* externs for labels */
- Xint x_nameoffset = 10, y_nameoffset = 0;
- Xint x_lbloffset = 7, y_lbloffset = 0;
- Xint x_magoffset = 7, y_magoffset = -10;
- X
- X/* externs for legend: variables of positioning are here */
- Xint l_til=105;
- Xint l_stil=85;
- X
- Xint l_lmar1=25;
- Xint l_lmar2=50;
- Xint l_ltext=75;
- Xint l_rmar1=150;
- Xint l_rmar2=175;
- Xint l_rtext=200;
- X
- Xint l_line1=72;
- Xint l_line2=60;
- Xint l_line3=47;
- Xint l_line4=35;
- Xint l_line5=22;
- Xint l_line6=10;
- X
- X/* Point sizes for font calls */
- Xint titlesize=18;
- Xint subtlsize=12;
- Xint namesize=10;
- Xint lblsize=10;
- Xint magsize=8;
- X
- X/* Fonts for font calls */
- Xint namefnt=TIMESROMAN;
- Xint lblfnt=TIMESROMAN;
- Xint magfnt=COURIER;
- Xint titlefnt=TIMESBOLD;
- Xint subtlfnt=TIMESROMAN;
- X
- X/* Scale multiplier, minimum,
- X mangitude change, maximum, for thumbnail,*/
- Xdouble th_smul=THSMUL;
- Xdouble th_smin=THSMIN;
- Xdouble th_madj=THMADJ;
- Xdouble th_mmax=THMMAX;
- X
- X#define MAX(a,b) ((a)>(b)?(a):(b))
- X#define MIN(a,b) ((a)<(b)?(a):(b))
- X
- X/* Font names */
- X#ifdef RELEASE3_FONTS
- Xstatic char *default_font_name = "*helvetica-medium-r-normal--10*";
- Xstatic char *greek_font_name = "*symbol-medium-r-normal--10*";
- Xstatic char *timesroman_font_name = "*times-medium-r-normal--";
- Xstatic char *timesbold_font_name = "*times-bold-r-normal--";
- Xstatic char *timesital_font_name = "*times-roman-i-normal--";
- Xstatic char *timesboldital_font_name = "*times-bold-i-normal--";
- Xstatic char *helv_font_name = "*helvetica-medium-r-normal--";
- Xstatic char *helvbold_font_name = "*helvetica-bold-r-normal--";
- Xstatic char *helvital_font_name = "*helvetica-medium-o-normal--";
- Xstatic char *helvboldital_font_name = "*helvetica-bold-o-normal--";
- Xstatic char *courier_font_name = "*courier-medium-r-normal--";
- Xstatic char *courital_font_name = "*courier-medium-i-normal--";
- Xstatic char *courbold_font_name = "*courier-bold-r-normal--";
- Xstatic char *couritalbold_font_name = "*courier-bold-o-normal--";
- X#else
- Xstatic char *default_font_name = "helvetica-medium10";
- Xstatic char *greek_font_name = "symbol-medium10";
- Xstatic char *timesroman_font_name = "times-roman";
- Xstatic char *timesbold_font_name = "times-bold";
- Xstatic char *timesital_font_name = "times-italic";
- Xstatic char *timesboldital_font_name = "times-bold-italic";
- Xstatic char *helv_font_name = "helvetica-medium";
- Xstatic char *helvbold_font_name = "helvetica-bold";
- Xstatic char *helvital_font_name = "helvetica-oblique";
- Xstatic char *helvboldital_font_name = "helvetica-boldoblique";
- Xstatic char *courier_font_name = "courier-medium";
- Xstatic char *courital_font_name = "courier-medium";
- Xstatic char *courbold_font_name = "courier-bold";
- Xstatic char *couritalbold_font_name = "courier-bold";
- X#endif /* RELEASE3_FONTS */
- X
- X
- X
- X/* Device control argument */
- XD_control_arg(s)
- Xchar *s;
- X{
- X int i = 0;
- X int c;
- X int j;
- X
- X while (c = s[i++])
- X switch (c) {
- X case 'p': /* Postscript preview */
- X post_preview = TRUE;
- X break;
- X case 'l': /* Postscript landscape */
- X post_preview = TRUE;
- X post_landscape = TRUE;
- X break;
- X case 'h': /* Hide */
- X hide_drawing = use_backup = TRUE;
- X break;
- X case 'b': /* Use backup */
- X use_backup = TRUE;
- X break;
- X case 'm': /* monochrome display */
- X is_color = FALSE;
- X break;
- X#ifdef STARXAW
- X case 't': /* Toolkit */
- X /* skip current argument */
- X j = i-1;
- X while (s[j]) {
- X if (s[j] == ' ') {
- X s[j] = '\0';
- X if (Xargc < 39)
- X Xargv[Xargc++] = &s[j+1];
- X };
- X j++;
- X };
- X i = j-1;
- X break;
- X#endif
- X default:
- X break;
- X }
- X}
- X
- X
- X#ifdef STARX11
- X/* Open the device */
- XD_open()
- X{
- X int x, y;
- X unsigned int border, depth, map_width;
- X Pixmap icon;
- X XSizeHints sizehints;
- X double legend_spacing;
- X
- X if (!(display = XOpenDisplay(NULL)))
- X return FALSE;
- X
- X X_setdisplay();
- X
- X /* open window */
- X window = XCreateSimpleWindow(display, RootWindow(display,screen_num), 12, 12,
- X 720, 540, 1, foreground, background);
- X
- X if (post_preview) {
- X sizehints.flags = PSize|PMinSize|PMaxSize;
- X if (post_landscape) {
- X sizehints.width = sizehints.min_width = sizehints.max_width = 792;
- X sizehints.height = sizehints.min_height = sizehints.max_height = 576;
- X } else {
- X sizehints.width = sizehints.min_width = sizehints.max_width = 576;
- X sizehints.height = sizehints.min_height = sizehints.max_height = 792;
- X };
- X } else {
- X sizehints.flags = PMinSize;
- X sizehints.min_width = 550; sizehints.min_height = 550;
- X }
- X
- X icon = XCreateBitmapFromData(display, window, icon_bits,
- X icon_width, icon_height);
- X Xargv[0] = g_argv[0];
- X XSetStandardProperties(display, window, prog, prog, icon, Xargv, Xargc,
- X &sizehints);
- X XDefineCursor(display, window, XCreateFontCursor(display, XC_crosshair));
- X XSelectInput(display, window, StructureNotifyMask);
- X XMapWindow(display, window);
- X while(!XCheckTypedWindowEvent(display, window, MapNotify, &event));
- X XSelectInput(display, window, ExposureMask);
- X
- X XGetGeometry(display, window, &root, &x, &y, &width,
- X &height, &border, &depth);
- X sizehints.max_width = sizehints.min_width = width;
- X sizehints.max_height = sizehints.min_height = height;
- X
- X
- X map_width = width - 72;
- X
- X fullpage.width = map_width;
- X fullpage.height = height - 72;
- X fullpage.x_offset = 18;
- X fullpage.y_offset = 36;
- X
- X /* main is 7/10 the printing space
- X */
- X mainmap.width = map_width;
- X mainmap.height = ((height - 72)*7)/10;
- X mainmap.x_offset = 18;
- X mainmap.y_offset = 18 + ((height - 72)*2.5)/10;
- X
- X /* Thumbscale is 2/10 the printing space */
- X thumbmap.width = map_width/2;
- X thumbmap.height = ((height - 72)*2)/10;
- X thumbmap.x_offset = 18 + map_width/2;
- X thumbmap.y_offset = 18;
- X
- X /* Need to adjust label here */
- X /* Want top of l_til to be at top of thumbmap */
- X l_til = thumbmap.height + thumbmap.y_offset - titlesize;
- X /* Space text in legends to fill space. Leave 10 on bottom.
- X Text totals 6*namesize+subtlsize. */
- X
- X legend_spacing = (l_til - 10 - 6*namesize - subtlsize)/7;
- X if (legend_spacing < 2) legend_spacing = 2;
- X
- X l_stil = l_til - subtlsize - legend_spacing;
- X l_line1 = l_stil - namesize - legend_spacing;
- X l_line2 = l_line1 - namesize - legend_spacing;
- X l_line3 = l_line2 - namesize - legend_spacing;
- X l_line4 = l_line3 - namesize - legend_spacing;
- X l_line5 = l_line4 - namesize - legend_spacing;
- X l_line6 = l_line5 - namesize - legend_spacing;
- X
- X
- X /* Actually, we left too much space above,
- X for proper postscript simulation.
- X We can make the maps higher */
- X if (!post_preview) {
- X fullpage.height = height - fullpage.y_offset - 18;
- X mainmap.height = height - mainmap.y_offset - 18;
- X }
- X
- X
- X sizehints.flags = PSize|PMinSize|PMaxSize;
- X XSetNormalHints(display, window, &sizehints);
- X
- X if ((!is_color) && use_backup)
- X backup = XCreatePixmap(display, window, width, height, depth);
- X else { /* Can't use backup pixmap on color: not enough memory */
- X use_backup = FALSE;
- X hide_drawing = FALSE;
- X }
- X draw_into = backup ? backup : window;
- X/* Should perhaps try and check for failure, and use some other
- X way of selecting use of window vs. backup */
- X
- X
- X values_GC.foreground = background; values_GC.background = foreground;
- X XChangeGC(display, default_GC, GCForeground|GCBackground, &values_GC);
- X XFillRectangle(display, draw_into, default_GC, 0, 0, width, height);
- X XSetForeground(display, default_GC, foreground);
- X XSetBackground(display, default_GC, background);
- X
- X return TRUE; /* open successful */
- X}
- X
- X/* Close the device */
- XD_close()
- X{
- X Window closebox; /* window to do close in */
- X XEvent closebox_event, window_event;
- X int i;
- X double lat, lon, tlat, tlon;
- X char outstr[81];
- X int ra_h, ra_m, ra_s;
- X int de_d, de_m, de_s;
- X char dsign;
- X
- X
- X flushlines();
- X if (use_backup)
- X XCopyArea(display, backup, window, default_GC, 0, 0, width, height,
- X 0, 0);
- X
- X closebox =XCreateSimpleWindow(display,window, 0, 0, 10, 10, 1, background,
- X foreground);
- X XDefineCursor(display, closebox,
- X XCreateFontCursor(display, XC_top_left_arrow));
- X XMapWindow(display,closebox);
- X XSelectInput(display, closebox, ButtonPressMask);
- X XSelectInput(display, window, ButtonPressMask|ExposureMask);
- X
- X D_comment("Waiting for close of window or mouse button 1 or 3 input");
- X
- X while (!XCheckWindowEvent(display, closebox, ButtonPressMask,
- X &closebox_event))
- X {
- X if (XCheckWindowEvent(display, window, ExposureMask, &window_event)
- X && (window_event.type == Expose))
- X if (use_backup)
- X XCopyArea(display, backup, window, default_GC,
- X window_event.xexpose.x, window_event.xexpose.y,
- X window_event.xexpose.width, window_event.xexpose.height,
- X window_event.xexpose.x, window_event.xexpose.y);
- X
- X if (XCheckWindowEvent(display, window, ButtonPressMask, &window_event)
- X && (window_event.type == ButtonPress)) {
- X if ((i = invxform((int) window_event.xbutton.x,
- X (int) height - window_event.xbutton.y,
- X &lat, &lon)) >= 0) {
- X if (lon < 0.0) lon += 360.0;
- X tlon = lon / 15.0;
- X
- X ra_h = tlon;
- X ra_m = (tlon - ra_h) * 60 + (0.5 / 60);
- X ra_s = (((tlon - ra_h) * 60) - ra_m) * 60 + 0.5;
- X
- X if (ra_s >= 60) {ra_s -= 60; ra_m++;};
- X if (ra_m >= 60) {ra_m -= 60; ra_h++;};
- X
- X
- X if (lat < 0.0) {
- X tlat = -lat;
- X dsign = '-';
- X } else {
- X tlat = lat;
- X dsign = '+';
- X }
- X
- X de_d = tlat;
- X de_m = (tlat - de_d) * 60 + (0.5 / 60);
- X de_s = (((tlat - de_d) * 60) - de_m) * 60 + 0.5;
- X
- X if (de_s >= 60) {de_s -= 60; de_m++;};
- X if (de_m >= 60) {de_m -= 60; de_d++;};
- X
- X
- X sprintf(outstr, "RA: %2dh%2dm%2ds dec: %c%2dd%2dm%2ds",
- X ra_h, ra_m, ra_s, dsign, de_d, de_m, de_s);
- X D_comment(outstr);
- X if (window_event.xbutton.button == Button3)
- X dblookup(i, lat, lon, 10);
- X } else {
- X/* fprintf(stderr, "Returned -1\n");*/
- X }
- X }
- X }
- X
- X XCloseDisplay(display);
- X}
- X
- X#endif /* STARX11 */
- X
- X#ifndef STARXTK
- XX_setdisplay()
- X{
- X char *str;
- X char *fore_color, *back_color;
- X XColor cdef;
- X Pixel *planes;
- X
- X screen_num = DefaultScreen(display);
- X black = BlackPixel(display, screen_num);
- X white = WhitePixel(display, screen_num);
- X
- X if ((str = XGetDefault(display, prog, "ReverseVideo"))
- X && strcmp(str, "on") == 0)
- X reverse = 1;
- X fore_color = XGetDefault(display, prog, "ForeGround");
- X back_color = XGetDefault(display, prog, "BackGround");
- X
- X /* get global defaults from .Xdefaults */
- X get_defaults();
- X
- X default_GC = DefaultGC(display, screen_num);
- X default_cmap = DefaultColormap(display, screen_num);
- X default_font = XLoadQueryFont(display, default_font_name);
- X
- X greek_font = XLoadQueryFont(display, greek_font_name);
- X
- X /* create color map */
- X
- X if (reverse) {
- X foreground = black;
- X background = white;
- X }
- X else {
- X foreground = white;
- X background = black;
- X }
- X
- X is_color &= (DisplayPlanes(display, screen_num) >= 4);
- X is_super_color = is_color & (DisplayPlanes(display, screen_num) >= 6);
- X ncolors = (is_color ? 12 : 2);
- X star_colors = (is_super_color ? 65: 0);
- X
- X if (is_color) {
- X pixels = (Pixel *)
- X malloc((unsigned int) (star_colors+ncolors)*sizeof(Pixel));
- X if (!XAllocColorCells(display, default_cmap, 0, planes,
- X 0, pixels, ncolors+star_colors)) {
- X fprintf(stderr, "Error, can't get color cells\n");
- X exit(10);
- X }
- X
- X cdef.flags = DoRed|DoBlue|DoGreen;
- X if (!fore_color ||
- X !XParseColor(display, default_cmap, fore_color, &cdef)) {
- X cdef.pixel = foreground ;
- X XQueryColor(display, default_cmap, &cdef) ;
- X }
- X cdef.pixel = pixels[0] ;
- X XStoreColor(display, default_cmap, &cdef) ;
- X
- X if (!back_color ||
- X !XParseColor(display, default_cmap, back_color, &cdef)) {
- X cdef.pixel = background ;
- X XQueryColor(display, default_cmap, &cdef) ;
- X }
- X cdef.pixel = pixels[1] ;
- X XStoreColor(display, default_cmap, &cdef) ;
- X D_setcolors();
- X }
- X}
- X#endif /* not STARXTK */
- X
- X/* Readstar globals */
- Xextern double obj_lat, obj_lon, obj_mag;
- Xextern char obj_type[3], obj_color[3], obj_label[3];
- Xextern char obj_constell[3], obj_name[];
- Xextern char *obj_commnt, fileline[];
- X
- X/* needed by readstar */
- Xint (*readfile)();
- Xextern char *cur_file_name;
- X
- Xdblookup(winnum, lat, lon, dpix)
- X int winnum;
- X double lat, lon;
- X int dpix;
- X{
- X int i;
- X double delta;
- X double f_east, f_north, f_west, f_south;
- X FILE *file1, *file2;
- X char ibuf[2020], fname[1030], ftypestr[32];
- X int n;
- X int ftype;
- X
- X#ifdef STARXAW
- X buffer_comment("Looking for object", FALSE);
- X#else
- X D_comment("Looking for object");
- X#endif
- X
- X delta = mapwin[winnum]->c_scale * dpix;
- X
- X for (i = 0; i < mapwin[winnum]->numfiles; i++) {
- X if ((file1 = fopen(mapwin[winnum]->file[i].name, "r")) == NULL) continue;
- X
- X cur_file_name = mapwin[winnum]->file[i].name;
- X ftype = mapwin[winnum]->file[i].type;
- X if (mapwin[winnum]->file[i].type == INDEXTYPE) {
- X /* read each line of index file, parse data on the files indexed:
- X region_included file_name
- X use an indexed file if the point is in the region */
- X
- X while (!feof(file1)) {
- X fgets(ibuf, 2000, file1);
- X n = sscanf(ibuf, "%lf %lf %lf %lf %1000s %30s\n", &f_east, &f_north,
- X &f_west, &f_south, fname, ftypestr);
- X if ((n != 6) || feof(file1)) continue;
- X
- X f_east *= 15.0;
- X f_west *= 15.0;
- X
- X if (westof(lon, f_east) && eastof(lon, f_west)
- X && (lat >= f_south) && (lat <= f_north)) {
- X if ((file2 = fopen(fname, "r")) == NULL) {
- X fprintf(stderr, "%s: error, couldn't open '%s' for reading.\n",
- X prog, fname);
- X } else {
- X cur_file_name = fname;
- X
- X ftype = tr_fty(ftypestr);
- X
- X if (ftype == INDEXTYPE) {
- X fprintf(stderr,
- X "%s: error, can't use type INDEXTYPE file '%s' from another index file.\n",
- X prog, fname);
- X } else {
- X do_look(file2, ftype, lat, lon, delta);
- X }
- X fclose(file2);
- X cur_file_name = "";
- X }
- X }
- X }
- X } else {
- X do_look(file1, ftype, lat, lon, delta);
- X }
- X
- X fclose(file1);
- X };
- X
- X#ifdef STARXAW
- X buffer_comment("Done search", FALSE);
- X#else
- X D_comment("Done search");
- X#endif
- X}
- X
- Xdo_look(file, ftype, lat, lon, delta)
- XFILE *file;
- Xint ftype;
- Xdouble lat, lon, delta;
- X{
- X double dlat, dlon;
- X double tlat, tlon;
- X int ra_h, ra_m, ra_s;
- X int de_d, de_m, de_s;
- X char dsign;
- X
- X char outstr[81];
- X
- X
- X while (!(*readfile)(file, ftype)) {
- X dlat = fabs(obj_lat - lat);
- X dlon = fabs(obj_lon - lon);
- X if ((dlat <= delta) && (dlon <= delta)) {
- X tlon = obj_lon/15.0;
- X ra_h = tlon;
- X ra_m = (tlon - ra_h) * 60 + (0.5 / 60);
- X ra_s = (((tlon - ra_h) * 60) - ra_m) * 60 + 0.5;
- X
- X if (ra_s >= 60) {ra_s -= 60; ra_m++;};
- X if (ra_m >= 60) {ra_m -= 60; ra_h++;};
- X
- X
- X if (obj_lat < 0.0) {
- X tlat = -obj_lat;
- X dsign = '-';
- X } else {
- X tlat = obj_lat;
- X dsign = '+';
- X }
- X
- X de_d = tlat;
- X de_m = (tlat - de_d) * 60 + (0.5 / 60);
- X de_s = (((tlat - de_d) * 60) - de_m) * 60 + 0.5;
- X
- X if (de_s >= 60) {de_s -= 60; de_m++;};
- X if (de_m >= 60) {de_m -= 60; de_d++;};
- X
- X
- X
- X sprintf(outstr,
- X "%2dh%2dm%2ds %c%2dd%2dm%2ds %5.2f %2s %2s %2s %3s %-25.25s %-14.14s",
- X ra_h, ra_m, ra_s, dsign, de_d, de_m, de_s, obj_mag,
- X obj_type, obj_color, obj_label, obj_constell,
- X obj_name, obj_commnt);
- X#ifdef STARXAW
- X buffer_comment(outstr, FALSE);
- X#else
- X D_comment(outstr);
- X#endif
- X }
- X }
- X}
- X
- X
- Xstatic int current_x, current_y;
- X
- X/* Move to (x, y) */
- XD_move(x, y)
- X int x, y;
- X{
- X current_x = x; current_y = y;
- X}
- X
- X
- Xstatic int curr_lsty = -1;
- X/* Draw a line of style line_style from the current point to (x, y) */
- XD_draw(x, y, line_style)
- X int x, y, line_style;
- X{
- X int xline_sty;
- X int dashes = 1;
- X
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X switch (cur_function) {
- X case CHRTOUTLN:
- X case CHRTHTICK:
- X case CHRTVTICK:
- X xline_sty = LineSolid;
- X dashes = 1;
- X break;
- X case GRID_RA:
- X case GRID_DEC:
- X xline_sty = LineDoubleDash;
- X dashes = 4;
- X break;
- X case ECLIPT:
- X xline_sty = LineDoubleDash;
- X dashes = 1;
- X break;
- X case CONSTBOUND:
- X xline_sty = LineDoubleDash;
- X dashes = 6;
- X break;
- X case CONSTPATTRN:
- X xline_sty = LineDoubleDash;
- X dashes = 8;
- X break;
- X case CONSTNAME:
- X case CHARTFILE:
- X default:
- X switch (line_style) {
- X case SOLID:
- X case VECSOLID:
- X xline_sty = LineSolid;
- X dashes = 1;
- X break;
- X case DASHED:
- X case VECDASH:
- X xline_sty = LineDoubleDash;
- X dashes = 5;
- X break;
- X case DOTTED:
- X case VECDOT:
- X xline_sty = LineDoubleDash;
- X dashes = 1;
- X break;
- X default:
- X xline_sty = LineSolid;
- X dashes = 1;
- X break;
- X };
- X break;
- X }
- X
- X/* Some servers can't do dashes */
- X if (!use_x_dashes)
- X xline_sty = LineSolid;
- X
- X
- X if (xline_sty != curr_lsty) {
- X values_GC.line_style = xline_sty;
- X values_GC.dashes = dashes;
- X XChangeGC(display, default_GC, GCLineStyle | GCDashList, &values_GC);
- X }
- X
- X XDrawLine(display, draw_into, default_GC,
- X current_x, height - current_y, x, height - y);
- X
- X
- X curr_lsty = xline_sty;
- X
- X if ((use_backup) && !hide_drawing)
- X XCopyArea(display, backup, window, default_GC, 0, 0, width, height,
- X 0, 0);
- X
- X/* XFlush(display);*/
- X
- X current_x = x; current_y = y;
- X}
- X/* This routine is encouraged to look at the extern cur_funtion
- X and change the line style drawn as desired */
- X
- X
- X/* Move to (x1, y1) then draw a line of style line_style to (x2, y2) */
- XD_movedraw(x1, y1, x2, y2, line_style)
- X int x1, y1, x2, y2, line_style;
- X{
- X D_move(x1, y1);
- X D_draw(x2, y2, line_style);
- X}
- X
- X
- Xstatic XPoint areapts[1000];
- Xstatic int nareapts;
- X/* Move to (x, y) to begin an area */
- XD_areamove(x, y)
- X int x, y;
- X{
- X nareapts = 0;
- X areapts[nareapts].x = x;
- X areapts[nareapts].y = height - y;
- X nareapts++;
- X}
- X
- X/* Add a segment to the area border */
- XD_areaadd(x, y)
- X int x, y;
- X{
- X areapts[nareapts].x = x;
- X areapts[nareapts].y = height - y;
- X nareapts++;
- X}
- X
- X/* Fill the area, after adding the last segment */
- XD_areafill(x, y)
- X int x, y;
- X{
- X areapts[nareapts].x = x;
- X areapts[nareapts].y = height - y;
- X nareapts++;
- X
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X XFillPolygon(display, draw_into, default_GC,
- X areapts, nareapts, Complex, CoordModeOrigin);
- X nareapts = 0;
- X}
- X
- X
- X
- X
- Xstatic int curr_colr;
- X/* Set the color to be used for lines, areas and text */
- X/* color_str is a 2 char (+ '\0') string
- X containing a specification for a color,
- X e.g. "G2" for the color of a star of spectral class G2, or "r7" for
- X red, level seven. The interpretation of the color string is left to
- X the device driver */
- XD_color(color_str)
- X char *color_str;
- X{
- X Pixel colr;
- X int class, subclass;
- X static char *table = "OBAFGKMRNSrgbycpow";
- X static int spectra[10] = {
- X BLUE_WHITE, BLUE, WHITE, WHITE, YELLOW, ORANGE, RED, RED, RED};
- X
- X static int super_spectra[][10] = {
- X /* 0 1 2 3 4 5 6 7 8 9 */
- X /* O */ { 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 },
- X /* B */ { 0, 1, 2, 3, 3, 4, 4, 4, 5, 6 },
- X /* A */ { 7, 7, 8, 9, 9, 10, 10, 10, 10, 10 },
- X /* F */ { 11, 11, 12, 12, 12, 13, 13, 13, 14, 14 },
- X /* G */ { 15, 15, 15, 15, 15, 16, 16, 16, 16, 16 },
- X /* K */ { 17, 17, 18, 18, 18, 19, 19, 19, 19, 19 },
- X /* M */ { 20, 20, 21, 22, 23, 24, 25, 26, 26, 26 },
- X /* R */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 },
- X /* N */ { 27, 27, 27, 28, 28, 28, 28, 28, 29, 30 },
- X /* S */ { 30, 30, 30, 30, 31, 31, 31, 31, 31, 31 },
- X /* r */ { 33, 33, 33, 34, 34, 34, 35, 35, 35, 36 },
- X /* g */ { 37, 37, 37, 38, 38, 38, 39, 39, 39, 40 },
- X /* b */ { 41, 41, 41, 42, 42, 42, 43, 43, 43, 44 },
- X /* y */ { 45, 45, 45, 46, 46, 46, 47, 47, 47, 48 },
- X /* c */ { 49, 49, 49, 50, 50, 50, 51, 51, 51, 52 },
- X /* p */ { 53, 53, 53, 54, 54, 54, 55, 55, 55, 56 },
- X /* o */ { 57, 57, 57, 58, 58, 58, 59, 59, 59, 60 },
- X /* w */ { 61, 61, 61, 62, 62, 62, 63, 63, 63, 64 }
- X };
- X
- X if (!is_color) return;
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X
- X class = 0;
- X while (table[class] && (table[class] != color_str[0])) class++;
- X
- X if (is_super_color) {
- X subclass = isdigit(color_str[1]) ? color_str[1] - '0' : 0;
- X colr = table[class] ? star_pixels[super_spectra[class][subclass]] :
- X pixels[WHITE];
- X } else
- X colr = table[class] ? pixels[spectra[class]] : pixels[WHITE];
- X
- X if (colr != curr_colr) {
- X flushlines();
- X XSetForeground(display, default_GC, colr);
- X };
- X}
- X
- X
- Xstatic int current_font = -1, current_fsize = -1;
- Xstatic XFontStruct *curr_xfont;
- X
- X/* Set the font and font size to be used for text. */
- X/* Note order of args */
- XD_fontsize(fsize, font)
- X int font, fsize;
- X{
- X char *fontname, readname[50];
- X
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X switch(cur_function) {
- X case CHRTOUTLN:
- X break;
- X case CHRTHTICK:
- X case CHRTVTICK:
- X font = TIMESBOLD;
- X break;
- X case GRID_RA:
- X case GRID_DEC:
- X case ECLIPT:
- X break;
- X case CONSTBOUND:
- X case CONSTPATTRN:
- X break;
- X case CONSTNAME:
- X font = HELVITAL;
- X break;
- X case CHARTFILE:
- X case CURNTFONT:
- X default:
- X break;
- X }
- X
- X if ((font == current_font) && (fsize == current_fsize)) return;
- X
- X switch(font)
- X {
- X case TIMESROMAN: fontname = timesroman_font_name; break;
- X case TIMESBOLD: fontname = timesbold_font_name; break;
- X case TIMESITAL: fontname = timesital_font_name; break;
- X case TIMESBOLDITAL: fontname = timesboldital_font_name; break;
- X case HELV: fontname = helv_font_name; break;
- X case HELVBOLD: fontname = helvbold_font_name; break;
- X case HELVITAL: fontname = helvital_font_name; break;
- X case HELVBOLDITAL: fontname = helvboldital_font_name; break;
- X case COURIER: fontname = courier_font_name; break;
- X case COURITAL: fontname = courital_font_name; break;
- X case COURBOLD: fontname = courbold_font_name; break;
- X case COURITALBOLD: fontname = couritalbold_font_name; break;
- X }
- X
- X#ifdef RELEASE3_FONTS
- X sprintf(readname,"%s%d*",fontname,fsize);
- X#else
- X sprintf(readname,"%s%d",fontname,fsize);
- X#endif
- X
- X if (!(curr_xfont = XLoadQueryFont(display, readname)))
- X curr_xfont = default_font;
- X else {
- X current_font = font;
- X current_fsize = fsize;
- X }
- X
- X if (curr_xfont)
- X XSetFont(display, default_GC, curr_xfont->fid);
- X}
- X/* This routine is encouraged to look at the extern cur_funtion
- X and change the font used as desired */
- X
- X
- Xstatic char *intable = " 0123456789abgdezh@iklmnEoprstuOx%w";
- Xstatic char *outtable = " 0123456789abgdezhqiklmnxoprstujcyw";
- X/* Display text string str at x,y, in current font and font size.
- X if star_lbl is TRUE, string is a star label, use
- X greek characters (if possible) */
- XD_text(x, y, s, star_lbl)
- X int x, y;
- X char *s;
- X int star_lbl;
- X{
- X char ch;
- X int i, j;
- X int use_greek = FALSE;
- X
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X if (star_lbl) {
- X if (isgreek(s[0]) && (isdigit(s[1]) || (s[1] == ' '))) {
- X /* Greek if first character is greek encoded,
- X and the second is space or a digit */
- X use_greek = TRUE;
- X if (greek_font)
- X XSetFont(display, default_GC, greek_font->fid);
- X#ifdef OLD_GREEK
- X /* Translate yaleformat greek encoding to Symbol font encoding */
- X i = 0;
- X while (ch = s[i])
- X {
- X j = 0;
- X while (intable[j] && (intable[j] != ch)) j++;
- X s[i] = intable[j] ? outtable[j] : s[i];
- X /* If not in translation table, leave it alone */
- X i++;
- X }
- X#endif
- X } else { /* Star label, but not greek */
- X /* remove leading spaces */
- X while (*s == ' ') s++;
- X }
- X }
- X
- X XDrawString(display, draw_into, default_GC, x,
- X height - y, s, strlen(s));
- X
- X if ((use_backup) && !hide_drawing)
- X XCopyArea(display, backup, window, default_GC, 0, 0, width, height,
- X 0, 0);
- X
- X/* XFlush(display);*/
- X
- X if (use_greek && curr_xfont) XSetFont(display, default_GC, curr_xfont->fid);
- X}
- X
- Xisgreek(c)
- Xchar c;
- X{
- X char *cp;
- X
- X#ifdef OLD_GREEK
- X cp = "abgdezh@iklmnEoprstuOx%w";
- X#else
- X cp = "abgdezhqiklmnxoprstujcyw";
- X#endif
- X while (*cp && (*cp != c)) cp++;
- X return (*cp != '\0'); /* True if letter was in greek string */
- X}
- X
- X
- X/* Return input coordinate in device coords where there are pointing devices */
- XD_inxy(x, y)
- X int *x, *y;
- X{
- X}
- X
- X
- X/* Put non-displayed comment in output. Allowed in postscript, but
- X few other drivers will be able to support this. */
- X#ifdef STARX11
- XD_comment(str)
- X char *str;
- X{
- X fprintf(stderr, "%s\n", str);
- X}
- X#endif /* STARX11 */
- X
- X
- X
- X/**
- XHigher level functions
- X**/
- X
- Xdrawlen(x, y, dx, dy, len)
- X int x,y, dx, dy, len;
- X{
- X buildlines(x + dx, (int)(height - (y+dy)), x+dx+len, (int)(height - (y+dy)));
- X}
- X
- X
- XD_setcolors()
- X{
- X Cardinal i;
- X
- X static int data[][3] = {
- X { 0, 0, 0 }, /* BLACK */
- X { 255, 255, 255 }, /* WHITE */
- X { 255, 0, 0 }, /* RED */
- X { 255, 100, 0 }, /* ORANGE */
- X { 255, 255, 0 }, /* YELLOW */
- X { 0, 255, 0 }, /* GREEN */
- X { 0, 255, 255 }, /* CYAN */
- X { 0, 0, 255 }, /* BLUE */
- X { 255, 0, 255 }, /* VIOLET */
- X { 130, 130, 255 }, /* BLUE_WHITE */
- X };
- X
- X double max_colr;
- X
- X static double super_data[][3] = {
- X /* Red Green Blue Name by which type is known */
- X/* 0 */ { 0.38937, 0.46526, 0.79493 }, /* B0 */
- X/* 1 */ { 0.39501, 0.47146, 0.78847 }, /* B1 */
- X/* 2 */ { 0.40103, 0.47792, 0.78151 }, /* B2 */
- X/* 3 */ { 0.40640, 0.48355, 0.77526 }, /* B3 */
- X/* 4 */ { 0.41341, 0.49071, 0.76701 }, /* B5 */
- X/* 5 */ { 0.43251, 0.50914, 0.74412 }, /* B8 */
- X/* 6 */ { 0.44342, 0.51897, 0.73079 }, /* B9 */
- X/* 7 */ { 0.45181, 0.52618, 0.72042 }, /* A0 */
- X/* 8 */ { 0.46931, 0.54026, 0.69847 }, /* A2 */
- X/* 9 */ { 0.47958, 0.54792, 0.68541 }, /* A3 */
- X/* 10 */ { 0.48538, 0.55205, 0.67797 }, /* A5 */
- X/* 11 */ { 0.50879, 0.56731, 0.64752 }, /* F0 */
- X/* 12 */ { 0.51732, 0.57231, 0.63627 }, /* F2 */
- X/* 13 */ { 0.52348, 0.57573, 0.62810 }, /* F5 */
- X/* 14 */ { 0.54076, 0.58447, 0.60496 }, /* F8 */
- X/* 15 */ { 0.54853, 0.58799, 0.59446 }, /* G0 */
- X/* 16 */ { 0.56951, 0.59623, 0.56584 }, /* G5 */
- X/* 17 */ { 0.58992, 0.60244, 0.53765 }, /* K0 */
- X/* 18 */ { 0.61098, 0.60693, 0.50828 }, /* K2 */
- X/* 19 */ { 0.63856, 0.60977, 0.46950 }, /* K5 */
- X/* 20 */ { 0.68698, 0.60595, 0.40110 }, /* M0 */
- X/* 21 */ { 0.72528, 0.59434, 0.34744 }, /* M2 */
- X/* 22 */ { 0.75182, 0.58144, 0.31097 }, /* M3 */
- X/* 23 */ { 0.78033, 0.56272, 0.27282 }, /* M4 */
- X/* 24 */ { 0.81066, 0.53676, 0.23394 }, /* M5 */
- X/* 25 */ { 0.84247, 0.50195, 0.19570 }, /* M6 */
- X/* 26 */ { 0.87512, 0.45667, 0.16004 }, /* M7 */
- X/* 27 */ { 0.71033, 0.59983, 0.36829 }, /* N0 */
- X/* 28 */ { 0.78625, 0.55816, 0.26507 }, /* N3 */
- X/* 29 */ { 0.93792, 0.33011, 0.10649 }, /* N8 */
- X/* 30 */ { 0.94897, 0.29906, 0.10012 }, /* N9 */
- X/* 31 */ { 0.79832, 0.54811, 0.24950 }, /* S4 */
- X/* 32 */ { 0.38241, 0.45743, 0.80282 }, /* O */
- X };
- X
- X XColor c;
- X
- X static struct {unsigned char red, green, blue;} other_colrs[] = {
- X { 0x80, 0, 0},
- X { 0xc0, 0, 0},
- X { 0xe0, 0, 0},
- X { 0xff, 0, 0},
- X { 0x0, 0x80, 0},
- X { 0x0, 0xc0, 0},
- X { 0x0, 0xe0, 0},
- X { 0x0, 0xff, 0},
- X { 0x0, 0x0, 0x80},
- X { 0x0, 0x0, 0xc0},
- X { 0x0, 0x0, 0xe0},
- X { 0x0, 0x0, 0xff},
- X { 0x80, 0x80, 0x0},
- X { 0xc0, 0xc0, 0x0},
- X { 0xe0, 0xe0, 0x0},
- X { 0xff, 0xff, 0x0},
- X { 0x0, 0x80, 0x80},
- X { 0x0, 0xc0, 0xc0},
- X { 0x0, 0xe0, 0xe0},
- X { 0x0, 0xff, 0xff},
- X { 0x80, 0x0, 0x80},
- X { 0xc0, 0x0, 0xc0},
- X { 0xe0, 0x0, 0xe0},
- X { 0xff, 0x0, 0xff},
- X { 0x80, 0x40, 0x00},
- X { 0xc0, 0x60, 0x00},
- X { 0xe0, 0x70, 0x00},
- X { 0xff, 0x80, 0x00},
- X { 0x80, 0x80, 0x80},
- X { 0xc0, 0xc0, 0xc0},
- X { 0xe0, 0xe0, 0xe0},
- X { 0xff, 0xff, 0xff}
- X };
- X
- X
- X c.flags = DoRed|DoGreen|DoBlue;
- X for (i=0; i<=9; i++) {
- X c.red = 256*data[i][0];
- X c.green = 256*data[i][1];
- X c.blue = 256*data[i][2];
- X c.pixel = pixels[i];
- X XStoreColor(display, default_cmap, &c);
- X }
- X
- X if (is_super_color) {
- X star_pixels = &(pixels[i]);
- X for (i=0; i<=32; i++) {
- X max_colr = super_data[i][0];
- X max_colr = super_data[i][1] > max_colr ? super_data[i][1] : max_colr;
- X max_colr = super_data[i][2] > max_colr ? super_data[i][2] : max_colr;
- X c.red = (int) 256*255*super_data[i][0] / max_colr;
- X c.green = (int) 256*255*super_data[i][1] /max_colr;
- X c.blue = (int) 256*255*super_data[i][2] /max_colr;
- X c.pixel = star_pixels[i];
- X XStoreColor(display, default_cmap, &c);
- X }
- X for (i = 33; i <= 64; i++) {
- X c.red = other_colrs[i-33].red*256;
- X c.green = other_colrs[i-33].green*256;
- X c.blue = other_colrs[i-33].blue*256;
- X c.pixel = star_pixels[i];
- X XStoreColor(display, default_cmap, &c);
- X };
- X }
- X}
- X
- X
- X#ifndef STARXTK
- X/* Differ in starXtk */
- X#define MAXDRAW 250
- Xstatic XSegment seg[MAXDRAW];
- Xstatic int npoints = 0;
- X
- Xbuildlines(x1, y1, x2, y2)
- X int x1, y1, x2, y2;
- X{
- X#ifdef STARXAW
- X if (is_killed()) return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X#endif
- X
- X if (npoints == MAXDRAW) flushlines();
- X seg[npoints].x1 = x1;
- X seg[npoints].y1 = y1;
- X seg[npoints].x2 = x2;
- X seg[npoints].y2 = y2;
- X npoints++;
- X}
- X
- Xflushlines()
- X{
- X#ifdef STARXAW
- X if (is_killed()) {
- X npoints = 0;
- X return; /* Return if process_events returns TRUE,
- X i.e. if the close box has been hit */
- X };
- X#endif
- X
- X curr_lsty = values_GC.line_style = LineSolid;
- X values_GC.dashes = 1;
- X XChangeGC(display, default_GC, GCLineStyle | GCDashList, &values_GC);
- X
- X XDrawSegments(display, draw_into, default_GC, seg, npoints);
- X npoints = 0;
- X
- X if ((use_backup) && !hide_drawing)
- X XCopyArea(display, backup, window, default_GC, 0, 0, width, height,
- X 0, 0);
- X XFlush(display);
- X}
- X
- Xkilllines()
- X{
- X npoints = 0;
- X}
- X#endif /* not STARXtk */
- X
- X
- X/* get global defaults from .Xdefaults */
- Xget_defaults()
- X{
- X char *str;
- X int i;
- X
- X /* Allow fonts to be overriden */
- X if (str = XGetDefault(display, prog,"default_font_name"))
- X default_font_name = str;
- X if (str = XGetDefault(display, prog, "greek_font_name"))
- X greek_font_name = str;
- X if (str = XGetDefault(display, prog, "timesroman_font_name"))
- X timesroman_font_name = str;
- X if (str = XGetDefault(display, prog, "timesbold_font_name"))
- X timesbold_font_name = str;
- X if (str = XGetDefault(display, prog, "timesital_font_name"))
- X timesital_font_name = str;
- X if (str = XGetDefault(display, prog, "timesboldital_font_name"))
- X timesboldital_font_name = str;
- X if (str = XGetDefault(display, prog, "helv_font_name"))
- X helv_font_name = str;
- X if (str = XGetDefault(display, prog, "helvbold_font_name"))
- X helvbold_font_name = str;
- X if (str = XGetDefault(display, prog, "helvital_font_name"))
- X helvital_font_name = str;
- X if (str = XGetDefault(display, prog, "helvboldital_font_name"))
- X helvboldital_font_name = str;
- X if (str = XGetDefault(display, prog, "courier_font_name"))
- X courier_font_name = str;
- X if (str = XGetDefault(display, prog, "courital_font_name"))
- X courital_font_name = str;
- X if (str = XGetDefault(display, prog, "courbold_font_name"))
- X courbold_font_name = str;
- X if (str = XGetDefault(display, prog, "couritalbold_font_name"))
- X couritalbold_font_name = str;
- X
- X /* set post_preview, hide_drawing, use_backup from .Xdefaults */
- X if ((str = XGetDefault(display, prog, "PostscriptPreview"))
- X && (!strcmp(str, "on") || !strcmp(str, "true")))
- X post_preview = TRUE;
- X if ((str = XGetDefault(display, prog, "PostscriptLandscape"))
- X && (!strcmp(str, "on") || !strcmp(str, "true")))
- X post_landscape = TRUE;
- X if ((str = XGetDefault(display, prog, "HideDrawing"))
- X && (!strcmp(str, "on") || !strcmp(str, "true")))
- X hide_drawing = TRUE;
- X if ((str = XGetDefault(display, prog, "UseBackup"))
- X && (!strcmp(str, "on") || !strcmp(str, "true")))
- X use_backup = TRUE;
- X
- X if ((str = XGetDefault(display, prog, "UseXDashes"))
- X && (!strcmp(str, "on") || !strcmp(str, "true")))
- X use_x_dashes = TRUE;
- X
- X if (str = XGetDefault(display, prog, "htick_lim"))
- X htick_lim = atoi(str);
- X if (str = XGetDefault(display, prog, "htext_lim"))
- X htext_lim = atoi(str);
- X if (str = XGetDefault(display, prog, "htext_xoff"))
- X htext_xoff = atoi(str);
- X if (str = XGetDefault(display, prog, "htext_yoff"))
- X htext_yoff = atoi(str);
- X if (str = XGetDefault(display, prog, "vtick_lim"))
- X vtick_lim = atoi(str);
- X if (str = XGetDefault(display, prog, "vtext_lim"))
- X vtext_lim = atoi(str);
- X if (str = XGetDefault(display, prog, "vtext_xoff"))
- X vtext_xoff = atoi(str);
- X if (str = XGetDefault(display, prog, "vtext_yoff"))
- X vtext_yoff = atoi(str);
- X
- X
- X/* externs for labels */
- X if (str = XGetDefault(display, prog, "x_nameoffset"))
- X x_nameoffset = atoi(str);
- X if (str = XGetDefault(display, prog, "y_nameoffset"))
- X y_nameoffset = atoi(str);
- X if (str = XGetDefault(display, prog, "x_lbloffset"))
- X x_lbloffset = atoi(str);
- X if (str = XGetDefault(display, prog, "y_lbloffset"))
- X y_lbloffset = atoi(str);
- X if (str = XGetDefault(display, prog, "x_magoffset"))
- X x_magoffset = atoi(str);
- X if (str = XGetDefault(display, prog, "y_magoffset"))
- X y_magoffset = atoi(str);
- X
- X/* externs for legend: variables of positioning are here */
- X if (str = XGetDefault(display, prog, "l_til"))
- X l_til = atoi(str);
- X if (str = XGetDefault(display, prog, "l_stil"))
- X l_stil = atoi(str);
- X
- X if (str = XGetDefault(display, prog, "l_lmar1"))
- X l_lmar1 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_lmar2"))
- X l_lmar2 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_ltext"))
- X l_ltext = atoi(str);
- X if (str = XGetDefault(display, prog, "l_rmar1"))
- X l_rmar1 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_rmar2"))
- X l_rmar2 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_rtext"))
- X l_rtext = atoi(str);
- X
- X if (str = XGetDefault(display, prog, "l_line1"))
- X l_line1 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_line2"))
- X l_line2 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_line3"))
- X l_line3 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_line4"))
- X l_line4 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_line5"))
- X l_line5 = atoi(str);
- X if (str = XGetDefault(display, prog, "l_line6"))
- X l_line6 = atoi(str);
- X
- X/* Point sizes for font calls */
- X if (str = XGetDefault(display, prog, "titlesize"))
- X titlesize = atoi(str);
- X if (str = XGetDefault(display, prog, "subtlsize"))
- X subtlsize = atoi(str);
- X if (str = XGetDefault(display, prog, "namesize"))
- X namesize = atoi(str);
- X if (str = XGetDefault(display, prog, "lblsize"))
- X lblsize = atoi(str);
- X if (str = XGetDefault(display, prog, "magsize"))
- X magsize = atoi(str);
- X
- X/* Fonts for font calls */
- X if ((str = XGetDefault(display, prog, "namefnt")) && (i = tr_fname(str)))
- X namefnt = i;
- X if ((str = XGetDefault(display, prog, "lblfnt")) && (i = tr_fname(str)))
- X lblfnt = i;
- X if ((str = XGetDefault(display, prog, "magfnt")) && (i = tr_fname(str)))
- X magfnt = i;
- X if ((str = XGetDefault(display, prog, "titlefnt")) && (i = tr_fname(str)))
- X titlefnt = i;
- X if ((str = XGetDefault(display, prog, "subtlfnt")) && (i = tr_fname(str)))
- X subtlfnt = i;
- X
- X/* Scale multiplier, minimum,
- X mangitude change, maximum, for thumbnail,*/
- X if (str = XGetDefault(display, prog, "th_smul"))
- X th_smul = atoi(str);
- X if (str = XGetDefault(display, prog, "th_smin"))
- X th_smin = atoi(str);
- X if (str = XGetDefault(display, prog, "th_madj"))
- X th_madj = atoi(str);
- X if (str = XGetDefault(display, prog, "th_mmax"))
- X th_mmax = atoi(str);
- X}
- X
- X
- X
- Xint tr_fname(s)
- Xchar *s;
- X{
- X int i;
- X
- X for (i = 0; s[i]; i++)
- X if (isupper(s[i]))
- X s[i] = tolower(s[i]);
- X
- X if(!strcmp(s, "timesroman")) return TIMESROMAN;
- X else if (!strcmp(s, "timesbold")) return TIMESBOLD;
- X else if (!strcmp(s, "timesital")) return TIMESITAL;
- X else if (!strcmp(s, "timesboldital")) return TIMESBOLDITAL;
- X else if (!strcmp(s, "helv")) return HELV;
- X else if (!strcmp(s, "helvbold")) return HELVBOLD;
- X else if (!strcmp(s, "helvital")) return HELVITAL;
- X else if (!strcmp(s, "helvboldital")) return HELVBOLDITAL;
- X else if (!strcmp(s, "courier")) return COURIER;
- X else if (!strcmp(s, "courbold")) return COURBOLD;
- X else if (!strcmp(s, "courital")) return COURITAL;
- X else if (!strcmp(s, "couritalbold")) return COURITALBOLD;
- X else return 0;
- X}
- END_OF_FILE
- if test 40722 -ne `wc -c <'starchart/starX11.c'`; then
- echo shar: \"'starchart/starX11.c'\" unpacked with wrong size!
- fi
- # end of 'starchart/starX11.c'
- fi
- echo shar: End of archive 29 \(of 32\).
- cp /dev/null ark29isdone
- 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
-
-
-