Changeset 4769
- Timestamp:
- Aug 15, 2005, 3:00:59 PM (21 years ago)
- Location:
- trunk/Ohana/src/kapa
- Files:
-
- 30 edited
-
Makefile (modified) (1 diff)
-
doc/Changes.log (modified) (1 diff)
-
event/FlushDisplay.c (modified) (1 diff)
-
event/PositionPicture.c (modified) (3 diffs)
-
event/SetSection.c (modified) (1 diff)
-
graph/DrawFrame.c (modified) (3 diffs)
-
graph/DrawObjects.c (modified) (3 diffs)
-
graph/DrawPtext.c (modified) (1 diff)
-
graph/DrawRotString.c (modified) (6 diffs)
-
graph/LoadObject.c (modified) (2 diffs)
-
graph/LoadPtext.c (modified) (1 diff)
-
graph/PNGit.c (modified) (10 diffs)
-
graph/PSFrame.c (modified) (4 diffs)
-
graph/PSLabels.c (modified) (1 diff)
-
graph/PSObjects.c (modified) (3 diffs)
-
graph/PSPtext.c (modified) (1 diff)
-
graph/cursor.c (modified) (2 diffs)
-
include/prototypes.h (modified) (1 diff)
-
include/structures.h (modified) (2 diffs)
-
setup/CheckColors.c (modified) (2 diffs)
-
setup/CheckDisplayName.c (modified) (2 diffs)
-
setup/CheckFontName.c (modified) (2 diffs)
-
setup/CheckGeometry.c (modified) (2 diffs)
-
setup/DefineLayout.c (modified) (3 diffs)
-
setup/MakeColormap.c (modified) (2 diffs)
-
setup/MakeGC.c (modified) (1 diff)
-
setup/OpenDisplay.c (modified) (1 diff)
-
setup/SetUpDisplay.c (modified) (1 diff)
-
setup/TopWindow.c (modified) (1 diff)
-
setup/Ximage.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa/Makefile
r3465 r4769 4 4 5 5 default: $(PROGRAM) 6 CC = gcc -g -Wall7 6 8 7 INC = $(HOME)/include -
trunk/Ohana/src/kapa/doc/Changes.log
r4477 r4769 1 2 kapa-1-2: 3 cleaned up complaints from -Wall -Werror. mostly defining 4 prototypes, removing unused variables, pushing Graphcolors 5 into the MakeColormap function 1 6 2 7 kapa-1-1: -
trunk/Ohana/src/kapa/event/FlushDisplay.c
r2473 r4769 14 14 if (!reftimeset) { 15 15 flush = TRUE; 16 gettimeofday (&reftime, (struct timeval *)NULL);16 gettimeofday (&reftime, NULL); 17 17 } 18 18 19 gettimeofday (&now, (struct timeval *)NULL);19 gettimeofday (&now, NULL); 20 20 dtime = DTIME (now, reftime); 21 21 -
trunk/Ohana/src/kapa/event/PositionPicture.c
r2473 r4769 4 4 5 5 int fontsize, bump, Nc; 6 double PADx, PADy, Dx, Dy , dPx, dPy;6 double PADx, PADy, Dx, Dy; 7 7 double PXm, PXp, PYm, PYp; 8 8 double X0, Y0, dX, dY; … … 64 64 layout[0].label[LABELX1].y = layout[0].axis[2].fy - bump; 65 65 66 sprintf (string, "%4g \0", layout[0].axis[1].min);66 sprintf (string, "%4g", layout[0].axis[1].min); 67 67 Nc = strlen (string); 68 sprintf (string, "%4g \0", layout[0].axis[1].max);68 sprintf (string, "%4g", layout[0].axis[1].max); 69 69 Nc = MAX (Nc, strlen (string)); 70 70 … … 73 73 layout[0].label[LABELY0].x = layout[0].axis[1].fx - bump; 74 74 75 sprintf (string, "%4g \0", layout[0].axis[1].min);75 sprintf (string, "%4g", layout[0].axis[1].min); 76 76 Nc = strlen (string); 77 sprintf (string, "%4g \0", layout[0].axis[1].max);77 sprintf (string, "%4g", layout[0].axis[1].max); 78 78 Nc = MAX (Nc, strlen (string)); 79 79 -
trunk/Ohana/src/kapa/event/SetSection.c
r2473 r4769 92 92 int ListSection () { 93 93 94 int i, status, Nbytes, NewSection, ThisSection, MoveSection;94 int i, status, Nbytes, ThisSection; 95 95 char buffer[128], name[128]; 96 double x, y, dx, dy;97 96 98 97 SCAN; -
trunk/Ohana/src/kapa/graph/DrawFrame.c
r2473 r4769 47 47 } 48 48 49 DrawTick (int fx, int fy, int dfx, int dfy,50 int P, double min, double max,51 double value, int mode, int naxis) {49 void DrawTick (int fx, int fy, int dfx, int dfy, 50 int P, double min, double max, 51 double value, int mode, int naxis) { 52 52 53 53 int x, y, dx, dy, pos, dir, fontsize; 54 double tmp,size, n;54 double size, n; 55 55 char string[64], *fontname; 56 56 … … 92 92 y = fy + (value-min)*dfy/(max - min) + dy; 93 93 if (fabs(value/(max-min)) < 0.001) { value = 0.0; } 94 sprintf (string, "%4g \0", value);94 sprintf (string, "%4g", value); 95 95 DrawRotText (x, y, string, pos, 0.0); 96 96 } … … 99 99 100 100 101 AxisTickScale (Axis *axis, double *major, double *minor) {101 void AxisTickScale (Axis *axis, double *major, double *minor) { 102 102 103 103 double range, lrange, factor, mantis, fmantis, power; -
trunk/Ohana/src/kapa/graph/DrawObjects.c
r2473 r4769 21 21 DrawObjectN (layout, &layout[0].objects[i]); 22 22 } 23 23 return (TRUE); 24 24 } 25 25 … … 29 29 static unsigned char dash[2] = {5,10}; 30 30 static unsigned char dot[2] = {3,3}; 31 int l type, lweight;31 int lweight; 32 32 33 33 lweight = MAX (0, MIN (10, object[0].lweight)); … … 74 74 XSetLineAttributes (graphic.display, graphic.gc, 0, LineSolid, CapNotLast, JoinMiter); 75 75 XSetForeground (graphic.display, graphic.gc, graphic.fore); 76 return (TRUE); 76 77 } 77 78 -
trunk/Ohana/src/kapa/graph/DrawPtext.c
r2473 r4769 3 3 void DrawPtext (Layout *layout) { 4 4 5 int i, width, pos,x, y, size;5 int i, x, y, size; 6 6 double angle; 7 7 char *fontname; -
trunk/Ohana/src/kapa/graph/DrawRotString.c
r2473 r4769 10 10 11 11 char *c, *bitmap, basefont[64]; 12 int i, dy, dx, N, X, Y, X1, Y1,code;12 int i, dy, dx, N, X, Y, code; 13 13 int dX, Xoff, dY, Yoff, YoffBase, basesize; 14 14 double cs, sn; … … 16 16 /* strip leading whitespace */ 17 17 for (c = string; (*c == ' ') || (*c == '\t'); c++); 18 if (*c == 0) return ;18 if (*c == 0) return (FALSE); 19 19 20 20 /* compute string length */ … … 97 97 } 98 98 SetRotFont (basefont, basesize); 99 } 100 101 int DrawRotBitmap (x, y, dx, dy, bitmap, mode, angle, scale) 102 int x, y, dx, dy; 103 char bitmap[]; 104 int mode; 105 double angle, scale; 106 { 99 return (TRUE); 100 } 101 102 int DrawRotBitmap (int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale) { 107 103 108 104 int ii, jj, byte_line, byte, bit, flag; 109 105 unsigned long int fore, back; 110 106 double i, j, cs, sn, rscale, tmp; 111 int X t, Yt, X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0;107 int X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0; 112 108 113 109 if (mode) { … … 214 210 } 215 211 XSetForeground (graphic.display, graphic.gc, graphic.fore); 216 } 217 218 InitRotFonts () { 212 return (TRUE); 213 } 214 215 void InitRotFonts () { 219 216 220 217 int i, Nhardwired; … … 448 445 449 446 450 PSDumpRotSegment (FILE *f, char *segment, int *Nseg) {447 void PSDumpRotSegment (FILE *f, char *segment, int *Nseg) { 451 448 fprintf (f, "(%s) show\n", segment); 452 449 bzero (segment, *Nseg); … … 454 451 } 455 452 456 PSSetFont (FILE *f, int size) {453 void PSSetFont (FILE *f, int size) { 457 454 if (!strcmp (currentname, "times")) 458 455 fprintf (f, "/Times-Roman findfont %d scalefont setfont\n", size); -
trunk/Ohana/src/kapa/graph/LoadObject.c
r2473 r4769 43 43 44 44 /* force valid ranges */ 45 if ((layout[0].objects[N].color > NGRAPHCOLORS) || (layout[0].objects[N].color < 0))45 if ((layout[0].objects[N].color > GetColormapSize()) || (layout[0].objects[N].color < 0)) 46 46 layout[0].objects[N].color = 0; 47 47 … … 182 182 } 183 183 184 FreeObjectData (Gobjects *object) {184 void FreeObjectData (Gobjects *object) { 185 185 186 186 if (object[0].x != (float *) NULL) free (object[0].x); -
trunk/Ohana/src/kapa/graph/LoadPtext.c
r2473 r4769 4 4 5 5 char buffer[256], *c; 6 int N, status, Nbytes, mode,size;6 int N, status, size; 7 7 double tmp, L; 8 8 Layout *layout; -
trunk/Ohana/src/kapa/graph/PNGit.c
r2473 r4769 1 1 # include "Ximage.h" 2 2 # include <png.h> 3 # define NPALETTE NGRAPHCOLORS4 3 5 4 int PNGit () { … … 8 7 png_structp png_ptr; 9 8 png_infop info_ptr; 10 png_color palette[NPALETTE];11 int pchoice[NPALETTE];9 png_color *palette; 10 int *pchoice; 12 11 XColor color; 13 12 png_byte **rows; 14 13 int dx, dy; 15 14 int i, j, k, found; 15 int Npalette; 16 16 XImage *tmpimage; 17 17 unsigned long pixel; 18 18 char filename[1024]; 19 19 int Nbytes, status; 20 21 Npalette = GetColormapSize (); 22 ALLOCATE (pchoice, int, Npalette); 23 ALLOCATE (palette, png_color, Npalette); 20 24 21 25 dx = graphic.dx; … … 35 39 36 40 /* define the palette */ 37 for (i = 0; i < N PALETTE; i++) {41 for (i = 0; i < Npalette; i++) { 38 42 color.pixel = graphic.color[i]; 39 43 XQueryColor (graphic.display, graphic.colormap, &color); … … 47 51 if (f == (FILE *) NULL) { 48 52 fprintf (stderr, "can't open output file %s\n", "Xgraph.png"); 53 free (pchoice); 54 free (palette); 49 55 return (TRUE); /* true because otherwise it quits kapa! */ 50 56 } … … 54 60 fclose (f); 55 61 fprintf (stderr, "can't get png structure\n"); 62 free (pchoice); 63 free (palette); 56 64 return (TRUE); 57 65 } … … 62 70 fclose (f); 63 71 fprintf (stderr, "can't get png info structure\n"); 72 free (pchoice); 73 free (palette); 64 74 return (TRUE); 65 75 } … … 69 79 fclose (f); 70 80 fprintf (stderr, "can't get png return\n"); 81 free (pchoice); 82 free (palette); 71 83 return (TRUE); 72 84 } … … 80 92 /* png_set_IHDR (png_ptr, info_ptr, dx, dy, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); */ 81 93 82 png_set_PLTE (png_ptr, info_ptr, palette, N PALETTE);94 png_set_PLTE (png_ptr, info_ptr, palette, Npalette); 83 95 84 96 png_write_info (png_ptr, info_ptr); … … 104 116 for (i = 0; i < dx; i++) { 105 117 pixel = XGetPixel (tmpimage, i, j); 106 for (found = k = 0; (k < N PALETTE) && !found; k++) {118 for (found = k = 0; (k < Npalette) && !found; k++) { 107 119 if (pixel == pchoice[k]) { 108 120 found = TRUE; … … 133 145 134 146 fclose (f); 147 free (pchoice); 148 free (palette); 135 149 return (TRUE); 136 150 -
trunk/Ohana/src/kapa/graph/PSFrame.c
r2473 r4769 4 4 int PSFrame (Layout *layout, FILE *f) { 5 5 6 int i, j,P, IsLabel, fontsize;6 int i, P, IsLabel, fontsize; 7 7 double fx, fy, dfx, dfy, range, major, minor, first, next; 8 8 char *fontname; … … 46 46 } 47 47 } 48 return (TRUE); 48 49 } 49 50 50 PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) {51 void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) { 51 52 52 53 int pos, dir, fontsize; … … 68 69 DrawLine (x, y, dx, dy); 69 70 70 # ifdef IN_AND_OUT_TICKS71 # define SPACE 0.0372 # else73 # define SPACE 0.0174 # endif75 76 71 if (mode == 1) { 77 72 fontname = GetRotFont (&fontsize); … … 87 82 y = fy + (value-min)*dfy/(max - min) + dy; 88 83 if (fabs(value) < 1e-14) { value = 0.0; } 89 sprintf (string, "%g \0", value);84 sprintf (string, "%g", value); 90 85 PSRotText (f, (int)x, (int)y, string, pos, 0.0); 91 86 } 92 93 87 } 94 88 -
trunk/Ohana/src/kapa/graph/PSLabels.c
r2473 r4769 3 3 void PSLabels (Layout *layout, FILE *f) { 4 4 5 int dX, dY, Xoff; 6 int i, width, pos, x, y, size; 5 int i, pos, x, y, size; 7 6 double angle; 8 7 char *fontname; 9 double cs, sn;10 8 11 9 fontname = GetRotFont (&size); -
trunk/Ohana/src/kapa/graph/PSObjects.c
r2473 r4769 90 90 int PSObjects (Layout *layout, FILE *f) { 91 91 92 int i , ltype;92 int i; 93 93 double lweight; 94 94 static char dash[] = "5"; … … 111 111 lweight = MAX (0, MIN (10, layout[0].objects[i].lweight)); 112 112 fprintf (f, "%.1f setlinewidth\n", lweight); 113 fprintf (f, "%s setrgbcolor\n", G RAPHCOLORS[layout[0].objects[i].color][1]);113 fprintf (f, "%s setrgbcolor\n", GetRGBString(layout[0].objects[i].color)); 114 114 115 115 switch (layout[0].objects[i].style) { … … 134 134 fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); 135 135 } 136 return (TRUE); 136 137 } 137 138 -
trunk/Ohana/src/kapa/graph/PSPtext.c
r2473 r4769 3 3 void PSPtext (Layout *layout, FILE *f) { 4 4 5 int i, width, pos,x, y, size;5 int i, x, y, size; 6 6 double angle; 7 7 char *fontname; -
trunk/Ohana/src/kapa/graph/cursor.c
r2473 r4769 6 6 XEvent event; 7 7 KeySym keysym; 8 int status, xstatus,value;8 int status, value; 9 9 XComposeStatus composestatus; 10 10 char string[10], line[35]; … … 79 79 y = (event.xkey.y - layout[0].axis[1].fy)*(layout[0].axis[1].max - layout[0].axis[1].min)/layout[0].axis[1].dfy + layout[0].axis[1].min; 80 80 if ((value > 0) && (isdigit(string[0]) || isalpha(string[0]))) { 81 sprintf (line, "%c %12.6f %12.6f \0", string[0], x, y);81 sprintf (line, "%c %12.6f %12.6f ", string[0], x, y); 82 82 write (sock, line, 32); 83 83 } -
trunk/Ohana/src/kapa/include/prototypes.h
r2473 r4769 1 Button *CheckButtons PROTO((XButtonEvent *, Layout *)); 2 void CheckColors PROTO((int *, char **)); 3 void CheckDisplayName PROTO((int *, char **, char *)); 4 void CheckFontName PROTO((int *, char **, char *)); 5 void CheckGeometry PROTO((int *, char **)); 6 int CheckPipe PROTO(()); 7 void CreateWindow PROTO((Window, int, long)); 8 void DefineLayout PROTO((int, char **)); 9 void DrawConnect PROTO((Layout *, Gobjects *)); 10 void DrawFrame PROTO((Layout *)); 11 void DrawHistogram PROTO((Layout *, Gobjects *)); 12 void DrawLabels PROTO((Layout *)); 13 int DrawObjectN PROTO((Layout *, Gobjects *)); 14 int DrawObjects PROTO((Layout *)); 15 void DrawPoints PROTO((Layout *, Gobjects *)); 16 void DrawXErrors PROTO((Layout *, Gobjects *)); 17 void DrawYErrors PROTO((Layout *, Gobjects *)); 18 int ErasePlot PROTO(()); 19 unsigned long GetColor PROTO((Display *, char *, Colormap, unsigned long)); 20 int GetColormapSize PROTO(()); 21 char *GetRGBString PROTO((int N)); 22 int InButton PROTO((XButtonEvent *, Button *)); 23 int InPicture PROTO((XButtonEvent *, Picture *)); 24 int ListSection PROTO(()); 25 int LoadBox PROTO(()); 26 void LoadFont PROTO((int *, char **, char *)); 27 int LoadLabels PROTO(()); 28 int LoadObject PROTO(()); 29 int LoadPtext PROTO(()); 30 int LoadVectorData PROTO((Layout *, int, char *)); 31 void MakeColormap PROTO((int, char **)); 32 void MakeCursor PROTO((unsigned int)); 33 void MapWindow PROTO(()); 34 void NameWindow PROTO((char *)); 35 Display *OpenDisplay PROTO((char *, int *)); 36 int PNGit PROTO(()); 37 int PPMit PROTO(()); 38 void PSConnect PROTO((Layout *, Gobjects *, FILE *)); 39 int PSFrame PROTO((Layout *, FILE *)); 40 void PSHistogram PROTO((Layout *, Gobjects *, FILE *)); 41 void PSLabels PROTO((Layout *, FILE *)); 42 int PSObjects PROTO((Layout *, FILE *)); 43 void PSPoints PROTO((Layout *, Gobjects *, FILE *)); 44 void PSXErrors PROTO((Layout *, Gobjects *, FILE *)); 45 void PSYErrors PROTO((Layout *, Gobjects *, FILE *)); 46 int PSit PROTO((int)); 47 void PositionPicture PROTO((Layout *)); 48 void QuitX PROTO((Display *, char *, char *)); 49 int Reconfig PROTO((XEvent *)); 50 void Refresh PROTO((int)); 51 void Remap PROTO((Layout *, Matrix *)); 52 int Resize PROTO(()); 53 int SetFont PROTO(()); 54 int SetLimits PROTO(()); 55 void SetNormalHints PROTO(()); 56 int SetSection PROTO((int SwitchSection)); 57 void SetUpDisplay PROTO((int *, char **)); 58 void SetUpWindow PROTO((int *, char **)); 59 void SetWMHints PROTO((Icon *)); 60 void TopWindow PROTO((Icon *)); 61 int cursor PROTO(()); 62 int get_argument PROTO((int, char **, char *)); 63 void hh_hms PROTO((char *, double, double, char)); 64 int remove_argument PROTO((int, int *, char **)); 1 65 2 # if (OLDPROTO) 3 /***** Prototypes for image ***************/ 66 int SetRotFont PROTO((char *name, int size)); 67 void InitRotFonts PROTO(()); 68 int DrawRotText PROTO((int x, int y, char *string, int pos, double angle)); 69 int DrawRotBitmap PROTO((int x, int y, int dx, int dy, char *bitmap, int mode, double angle, double scale)); 70 char *GetRotFont PROTO((int *size)); 71 int RotStrlen PROTO((char *c)); 72 void PSRotText PROTO((FILE *f, int x, int y, char *string, int pos, double angle)); 73 void PSDumpRotSegment PROTO((FILE *f, char *segment, int *Nseg)); 74 void PSSetFont PROTO((FILE *f, int size)); 75 void MakeGC (); 4 76 5 void PositionPictures PROTO((Layout *, Graphic *)); 6 void CreateColorbar PROTO((Layout *, Graphic *)); 77 int EventLoop (); 78 void CloseDisplay (); 79 80 void DrawPtext (Layout *layout); 81 void FlushDisplay (); 82 void AxisTickScale (Axis *axis, double *major, double *minor); 83 void DrawFrame (Layout *layout); 84 void DrawTick (int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int mode, int naxis); 85 void FreeObjectData (Gobjects *object); 86 void PSPtext (Layout *layout, FILE *f); 87 void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis); 88 89 /******************* XGRAPH ** 90 void StatusBox PROTO((Graphic *, Layout *)); 91 void ResetColorbar PROTO((Graphic *, Layout *, double, double)); 92 void Reorient PROTO((Graphic *, Layout *, XButtonEvent *)); 93 void PaintOverlay PROTO((Graphic *, Layout *, int)); 94 void MakeGC PROTO((Graphic *)); 95 void InvertButton PROTO((Graphic *, Button *)); 96 void FlashButton PROTO((Graphic *, Button *)); 97 void DrawButton PROTO((Graphic *, Button *)); 98 void DrawBitmap PROTO((Graphic *, int, int, int, int, char *, int)); 99 void DragColorbar PROTO((Graphic *, Layout *, XButtonEvent *)); 100 void CrossHairs PROTO((Graphic *, Layout *)); 101 void CreateZoom PROTO((Layout *, Graphic *, double, double)); 7 102 void CreatePicture PROTO((Layout *, Graphic *)); 8 void CreateZoom PROTO((Layout *, Graphic *, double, double));9 void Remap PROTO((Layout *, Matrix *));10 int NewPicture PROTO((Graphic *, Layout *));11 void Reorient PROTO((Graphic *, Layout *, XButtonEvent *));12 int UpdatePointer PROTO((Graphic *, Layout *, XMotionEvent *));13 void CrossHairs PROTO((Graphic *, Layout *));14 int LoadOverlay PROTO((Graphic *, Layout *));15 int SaveOverlay PROTO((Graphic *, Layout *));16 int CSaveOverlay PROTO((Graphic *, Layout *));17 int EraseOverlay PROTO((Graphic *, Layout *));18 void StatusBox PROTO((Graphic *, Layout *));19 void PaintOverlay PROTO((Graphic *, Layout *, int));20 21 /***** Prototypes for action ***************/22 23 int CheckPipe PROTO((Graphic *, Layout *));24 void DefineLayout PROTO((Layout *, Graphic *, int, char **));25 int EventLoop PROTO((Graphic *, Layout *));26 int InPicture PROTO((XButtonEvent *, Picture *));27 int InterpretKeys PROTO((Graphic *, Layout *, XEvent *));28 int InterpretPresses PROTO((Graphic *, Layout *, XButtonEvent *));29 int Reconfig PROTO((Graphic *, Layout *, XEvent *));30 void Refresh PROTO((Graphic *, Layout *, int));31 int Stop PROTO((Graphic *, Layout *));32 int PSit PROTO((Graphic *, Layout *));33 int get_argument PROTO((int, char **, char *));34 int remove_argument PROTO((int, int *, char **));35 void DragColorbar PROTO((Graphic *, Layout *, XButtonEvent *));36 void ResetColorbar PROTO((Graphic *, Layout *, double, double));37 void MakeColormap PROTO((Graphic *, Layout *, int, char **));38 39 /***** Prototypes for button ***************/40 41 Button *CheckButtons PROTO((XButtonEvent *, Layout *));42 void DrawButton PROTO((Graphic *, Button *));43 void FlashButton PROTO((Graphic *, Button *));44 int InButton PROTO((XButtonEvent *, Button *));45 void InvertButton PROTO((Graphic *, Button *));46 int greycolors PROTO((Graphic *, Layout *));47 103 int rainbow PROTO((Graphic *, Layout *)); 48 104 int puns PROTO((Graphic *, Layout *)); 105 int greycolors PROTO((Graphic *, Layout *)); 106 int UpdatePointer PROTO((Graphic *, Layout *, XMotionEvent *)); 107 int ToggleDEG PROTO((Graphic *, Layout *)); 108 int Stop PROTO((Graphic *, Layout *)); 109 int SaveOverlay PROTO((Graphic *, Layout *)); 110 int Rescale PROTO((Graphic *, Layout *)); 111 int RecenterRescale PROTO((Graphic *, Layout *)); 49 112 int Recenter PROTO((Graphic *, Layout *)); 50 int RecenterRescalePROTO((Graphic *, Layout *));51 int RescalePROTO((Graphic *, Layout *));52 int ToggleDEGPROTO((Graphic *, Layout *));113 int Overlay3 PROTO((Graphic *, Layout *)); 114 int Overlay2 PROTO((Graphic *, Layout *)); 115 int Overlay1 PROTO((Graphic *, Layout *)); 53 116 int Overlay0 PROTO((Graphic *, Layout *)); 54 int Overlay1 PROTO((Graphic *, Layout *)); 55 int Overlay2 PROTO((Graphic *, Layout *)); 56 int Overlay3 PROTO((Graphic *, Layout *)); 57 58 /***** Prototypes for xtools ***************/ 59 60 void CheckColors PROTO((Graphic *, int *, char **)); 61 void CheckDisplayName PROTO((int *, char **, char *)); 62 void CheckFontName PROTO((int *, char **, char *)); 63 void CheckGeometry PROTO((int *, char **, Graphic *)); 64 void CloseDisplay PROTO((Graphic *)); 65 void CreateWindow PROTO((Graphic *, Window, int, long)); 66 void DrawBitmap PROTO((Graphic *, int, int, int, int, char *, int)); 67 unsigned long GetColor PROTO((Display *, char *, Colormap, unsigned long)); 68 void LoadFont PROTO((Graphic *, int *, char **, char *)); 69 void MakeCursor PROTO((Graphic *, unsigned int)); 70 void MakeGC PROTO((Graphic *)); 71 void MapWindow PROTO((Graphic *)); 72 void NameWindow PROTO((Graphic *, char *)); 73 Display *OpenDisplay PROTO((char *, int *)); 74 void QuitX PROTO((Display *, char *, char *)); 75 void SetNormalHints PROTO((Graphic *)); 76 Display *SetUpDisplay PROTO((Graphic *, int *, char **)); 77 void SetUpWindow PROTO((Graphic *, int *, char **)); 78 void SetWMHints PROTO((Graphic *, Icon *)); 79 void TopWindow PROTO((Graphic *, Icon *)); 80 81 void hh_hms PROTO((char *, double, double, char)); 82 # endif 83 84 Display *SetUpDisplay (int *, char **); 85 Display *OpenDisplay (char *, int *); 86 void CheckDisplayName (int *, char **, char *); 87 void CheckColors (int *, char **); 88 void SetUpWindow (int *, char **); 89 void CheckGeometry (int *, char **); 90 void TopWindow (Icon *); 91 void QuitX (Display *, char *, char *); 92 void CreateWindow (Window, int, long); 93 void MakeCursor (unsigned int); 94 void CheckFontName (int *, char **, char *); 95 void LoadFont (int *, char **, char *); 96 void SetNormalHints (); 97 void SetWMHints (Icon *); 98 void NameWindow (char *); 99 void MapWindow (); 100 void MakeColormap (int, char **); 101 void DefineLayout (int, char **); 102 void PositionPicture (Layout *); 103 void DrawFrame (Layout *); 104 int DrawObjects (Layout *); 105 int DrawObjectN (Layout *, Gobjects *); 106 void DrawConnect (Layout *, Gobjects *); 107 void DrawHistogram (Layout *, Gobjects *); 108 void DrawPoints (Layout *, Gobjects *); 109 void DrawXErrors (Layout *, Gobjects *); 110 void DrawYErrors (Layout *, Gobjects *); 111 void DrawLabels (Layout *); 112 void Refresh (int); 113 int CheckPipe (); 114 int PSit (int); 115 int PSObjects (Layout *, FILE *); 116 void PSConnect (Layout *, Gobjects *, FILE *); 117 void PSHistogram (Layout *, Gobjects *, FILE *); 118 void PSPoints (Layout *, Gobjects *, FILE *); 119 void PSXErrors (Layout *, Gobjects *, FILE *); 120 void PSYErrors (Layout *, Gobjects *, FILE *); 121 int LoadObject (); 122 int LoadVectorData (Layout *, int, char *); 123 int SetLimits (); 124 int LoadLabels (); 125 int SetFont (); 126 int cursor (); 127 int ErasePlot (); 128 int Reconfig (XEvent *); 129 int LoadBox (); 130 int PSFrame (Layout *, FILE *); 131 void PSLabels (Layout *, FILE *); 117 int NewPicture PROTO((Graphic *, Layout *)); 118 int LoadOverlay PROTO((Graphic *, Layout *)); 119 int InterpretPresses PROTO((Graphic *, Layout *, XButtonEvent *)); 120 int InterpretKeys PROTO((Graphic *, Layout *, XEvent *)); 121 int EventLoop PROTO((Graphic *, Layout *)); 122 int EraseOverlay PROTO((Graphic *, Layout *)); 123 int CSaveOverlay PROTO((Graphic *, Layout *)); 124 */ -
trunk/Ohana/src/kapa/include/structures.h
r3465 r4769 1 /** this list must match the one in mana/include/package.h, and equiv */2 # define NGRAPHCOLORS 233 static char GRAPHCOLORS[NGRAPHCOLORS][2][15] = {4 {"black", "0.00 0.00 0.00"},5 {"white", "1.00 1.00 1.00"},6 {"red", "1.00 0.00 0.00"},7 {"pink", "1.00 0.75 0.80"},8 {"orange", "1.00 0.65 0.00"},9 {"yellow", "1.00 1.00 0.00"},10 {"wheat", "0.96 0.87 0.70"},11 {"gold", "1.00 0.84 0.00"},12 {"green", "0.00 1.00 0.00"},13 {"darkgreen","0.00 0.40 0.00"},14 {"blue", "0.00 0.00 1.00"},15 {"skyblue", "0.53 0.81 0.92"},16 {"indigo", "0.56 0.16 0.87"},17 {"violet", "1.00 0.00 0.00"},18 {"grey10", "0.10 0.10 0.10"},19 {"grey20", "0.20 0.20 0.20"},20 {"grey30", "0.30 0.30 0.30"},21 {"grey40", "0.40 0.40 0.40"},22 {"grey50", "0.50 0.50 0.50"},23 {"grey60", "0.60 0.60 0.60"},24 {"grey70", "0.70 0.70 0.70"},25 {"grey80", "0.80 0.80 0.80"},26 {"grey90", "0.90 0.90 0.90"}};27 1 28 2 /**************** Graphic carries X info around ****************/ … … 40 14 unsigned long fore; 41 15 unsigned long back; 42 unsigned long color[NGRAPHCOLORS];16 unsigned long *color; 43 17 } Graphic; 44 18 -
trunk/Ohana/src/kapa/setup/CheckColors.c
r2473 r4769 6 6 char *temp_name; 7 7 int N; 8 unsigned long temp_color;9 8 10 9 graphic.fore = BlackPixel (graphic.display, graphic.screen); 11 10 temp_name = XGetDefault (graphic.display, argv[0], "Foreground"); 12 if ( N = get_argument (*argc, argv, "-fg")) {11 if ((N = get_argument (*argc, argv, "-fg"))) { 13 12 if (N + 1 < *argc) { 14 13 temp_name = argv[N+1]; … … 23 22 graphic.back = WhitePixel (graphic.display, graphic.screen); 24 23 temp_name = XGetDefault (graphic.display, argv[0], "Background"); 25 if ( N = get_argument (*argc, argv, "-bg")) {24 if ((N = get_argument (*argc, argv, "-bg"))) { 26 25 if (N + 1 < *argc) { 27 26 temp_name = argv[N+1]; -
trunk/Ohana/src/kapa/setup/CheckDisplayName.c
r2473 r4769 7 7 8 8 display_name[0] = 0; 9 if ( N = get_argument (*argc, argv, "-d")) {9 if ((N = get_argument (*argc, argv, "-d"))) { 10 10 if (N + 1 < *argc) { 11 11 strcpy (display_name, argv[N + 1]); … … 18 18 } 19 19 20 if ( N = get_argument (*argc, argv, "-display")) {20 if ((N = get_argument (*argc, argv, "-display"))) { 21 21 if (N + 1 < *argc) { 22 22 strcpy (display_name, argv[N + 1]); -
trunk/Ohana/src/kapa/setup/CheckFontName.c
r2473 r4769 6 6 int N; 7 7 8 if ( N = get_argument (*argc, argv, "-font")) {8 if ((N = get_argument (*argc, argv, "-font"))) { 9 9 if (N + 1 < *argc) { 10 10 strcpy (fontname, argv[N + 1]); … … 16 16 } 17 17 } 18 if ( N = get_argument (*argc, argv, "-fn")) {18 if ((N = get_argument (*argc, argv, "-fn"))) { 19 19 if (N + 1 < *argc) { 20 20 strcpy (fontname, argv[N + 1]); -
trunk/Ohana/src/kapa/setup/CheckGeometry.c
r2473 r4769 10 10 11 11 temp_name = XGetDefault (graphic.display, argv[0], "geometry"); 12 if ( N = get_argument (*argc, argv, "-geom")) {12 if ((N = get_argument (*argc, argv, "-geom"))) { 13 13 if (N + 1 < *argc) { 14 14 temp_name = argv[N+1]; … … 29 29 if (status & WidthValue) { 30 30 dX = dx; 31 MAX (dX, MIN_WIDTH);32 31 } 33 32 if (status & HeightValue) { 34 33 dY = dy; 35 MAX (dY, MIN_HEIGHT);36 34 } 37 35 if (status & XNegative) X = DisplayWidth (graphic.display, graphic.screen) - dX + X; -
trunk/Ohana/src/kapa/setup/DefineLayout.c
r2473 r4769 5 5 void DefineLayout (int argc, char **argv) { 6 6 7 int i, j, status, N, offset, FOREGROUND; 8 Visual *visual = CopyFromParent; 7 int i, status, N, FOREGROUND; 9 8 struct sockaddr_un Address; 10 9 char temp[100]; 11 double PADx, PADy;12 10 13 11 if ((N = get_argument (argc, argv, "-debug"))) { … … 33 31 Address.sun_family = AF_UNIX; 34 32 sock = socket (AF_UNIX, SOCK_STREAM, 0); 35 status = connect (sock, &Address, sizeof (Address));33 status = connect (sock, (struct sockaddr *) &Address, sizeof (Address)); 36 34 if (status < 0) { 37 35 fprintf (stderr, "kapa - unsuccessful connection: %d\n", status); … … 39 37 } 40 38 fcntl (sock, F_SETFL, O_NONBLOCK); 41 sprintf (temp, "rm -f %s \0", argv[1]);39 sprintf (temp, "rm -f %s", argv[1]); 42 40 system (temp); 43 41 } -
trunk/Ohana/src/kapa/setup/MakeColormap.c
r2473 r4769 1 1 # include "Ximage.h" 2 3 /* this list must match the one in mana/include/package.h, and equiv 4 * we need to define library calls to the kapa and kii packages which mana 5 * and other programs would link against. This would allow them to have 6 * access to the list of available colors. Or... we need to have mana, etc 7 * query kapa/kii about it list of colors... 8 */ 9 10 # define NGRAPHCOLORS 23 11 static char GRAPHCOLORS[NGRAPHCOLORS][2][15] = { 12 {"black", "0.00 0.00 0.00"}, 13 {"white", "1.00 1.00 1.00"}, 14 {"red", "1.00 0.00 0.00"}, 15 {"pink", "1.00 0.75 0.80"}, 16 {"orange", "1.00 0.65 0.00"}, 17 {"yellow", "1.00 1.00 0.00"}, 18 {"wheat", "0.96 0.87 0.70"}, 19 {"gold", "1.00 0.84 0.00"}, 20 {"green", "0.00 1.00 0.00"}, 21 {"darkgreen","0.00 0.40 0.00"}, 22 {"blue", "0.00 0.00 1.00"}, 23 {"skyblue", "0.53 0.81 0.92"}, 24 {"indigo", "0.56 0.16 0.87"}, 25 {"violet", "1.00 0.00 0.00"}, 26 {"grey10", "0.10 0.10 0.10"}, 27 {"grey20", "0.20 0.20 0.20"}, 28 {"grey30", "0.30 0.30 0.30"}, 29 {"grey40", "0.40 0.40 0.40"}, 30 {"grey50", "0.50 0.50 0.50"}, 31 {"grey60", "0.60 0.60 0.60"}, 32 {"grey70", "0.70 0.70 0.70"}, 33 {"grey80", "0.80 0.80 0.80"}, 34 {"grey90", "0.90 0.90 0.90"}}; 35 36 int GetColormapSize () { 37 return (NGRAPHCOLORS); 38 } 39 40 char *GetRGBString (int N) { 41 return (GRAPHCOLORS[N][1]); 42 } 2 43 3 44 void MakeColormap (int argc, char **argv) { … … 6 47 char *temp_name; 7 48 49 ALLOCATE (graphic.color, unsigned long, NGRAPHCOLORS); 8 50 9 51 for (i = 0; i < NGRAPHCOLORS; i++) { -
trunk/Ohana/src/kapa/setup/MakeGC.c
r2473 r4769 4 4 void MakeGC () { 5 5 6 GC gc;7 6 XGCValues gcvalues; 8 7 -
trunk/Ohana/src/kapa/setup/OpenDisplay.c
r2473 r4769 5 5 6 6 Display *display; 7 char *tmp;8 7 9 8 display = XOpenDisplay (display_name); -
trunk/Ohana/src/kapa/setup/SetUpDisplay.c
r2473 r4769 2 2 3 3 /************** SetUpDisplay *************/ 4 Display *SetUpDisplay (int *argc, char **argv) {4 void SetUpDisplay (int *argc, char **argv) { 5 5 6 6 char display_name[120]; -
trunk/Ohana/src/kapa/setup/TopWindow.c
r2473 r4769 4 4 void TopWindow (Icon *icon) { 5 5 6 int screen;7 6 Window rootwindow; 8 7 -
trunk/Ohana/src/kapa/setup/Ximage.c
r2473 r4769 1 1 # include "Ximage.h" 2 2 3 main (argc, argv) 4 int argc; 5 char *argv[]; 6 7 { 3 int main (int argc, char **argv) { 8 4 9 5 SetUpDisplay (&argc, argv); … … 15 11 XFreeFont (graphic.display, graphic.font); 16 12 CloseDisplay (); 17 13 exit (0); 18 14 } 19 15
Note:
See TracChangeset
for help on using the changeset viewer.
