Changeset 13344
- Timestamp:
- May 10, 2007, 5:24:58 PM (19 years ago)
- Files:
-
- 2 added
- 41 edited
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/globals.h (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h (modified) (5 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CSaveOverlay.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Center.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c (modified) (11 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/DefineSection.c (modified) (3 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseCurrentPlot.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseOverlay.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/GetPixelCount.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Graphs.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Image.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretKeys.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretPresses.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/JPEGit24.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Layout.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadFrame.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadLabels.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadObject.c (modified) (8 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadOverlay.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadPicture.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTextlines.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTickmarks.c (modified) (3 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PNGit.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PPMit.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PSit.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Resize.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SaveOverlay.c (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Sections.c (modified) (3 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetFont.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetLimits.c (modified) (4 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetSection.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/UpdatePointer.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/kapa.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/libkapa/Makefile (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/IOfuncs.c (modified) (3 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/close.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h (modified) (2 diffs)
-
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/Makefile (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_image.c (modified) (1 diff)
-
branches/kapa-mods-2007-05/Ohana/src/opihi/mana/mana.c.in (modified) (1 diff)
-
trunk/Ohana/src/libkapa/src/KapaOpen.c (added)
-
trunk/Ohana/src/opihi/lib.data/open_kapa.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/globals.h
r13333 r13344 15 15 16 16 /* file descriptor for socket connection to mana */ 17 int sock;17 // int sock; 18 18 19 19 /* each layout / section defines one of the active portions of the graphics window -
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h
r13333 r13344 39 39 40 40 /* EventLoop */ 41 int PScommand PROTO(( ));41 int PScommand PROTO((int sock)); 42 42 int CheckPipe PROTO(()); 43 43 int Reconfig PROTO((XEvent *event)); … … 45 45 46 46 /* CheckPipe */ 47 int PNGit PROTO(()); 48 int PPMit PROTO(()); 49 int LoadFrame PROTO(()); 50 int LoadObject PROTO(()); 51 int LoadLabels PROTO(()); 52 int LoadTextlines PROTO(()); 53 int LoadVectorData PROTO(()); 54 int Resize PROTO(()); 55 int GetLimits PROTO(()); 56 int SetLimits PROTO(()); 57 int SetSection PROTO(()); 58 int ListSection PROTO(()); 59 int DefineSection PROTO(()); 60 int SetFont PROTO(()); 61 int EraseCurrentPlot PROTO(()); 62 int ErasePlots PROTO(()); 63 int EraseSections PROTO(()); 47 int PNGit PROTO((int sock)); 48 int PPMit PROTO((int sock)); 49 int LoadFrame PROTO((int sock)); 50 int LoadObject PROTO((int sock)); 51 int LoadLabels PROTO((int sock)); 52 int LoadTextlines PROTO((int sock)); 53 int Resize PROTO((int sock)); 54 int GetLimits PROTO((int sock)); 55 int SetLimits PROTO((int sock)); 56 int SetSection PROTO((int sock)); 57 int ListSection PROTO((int sock)); 58 int DefineSection PROTO((int sock)); 59 int SetFont PROTO((int sock)); 60 int EraseCurrentPlot PROTO((void)); 61 int ErasePlots PROTO((void)); 62 int EraseSections PROTO((void)); 63 64 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); 64 65 65 66 /* Section Utilities */ … … 74 75 Section *GetActiveSection PROTO(()); 75 76 int SetActiveSectionByNumber PROTO((int N)); 76 int ListSection PROTO(( ));77 int ListSection PROTO((int sock)); 77 78 78 79 KapaGraphWidget *InitGraph PROTO(()); 79 80 void DrawGraph PROTO((KapaGraphWidget *graph)); 80 81 void SetGraphSize PROTO((Section *section)); 82 void FreeGraph PROTO((KapaGraphWidget *graph)); 81 83 82 84 void InitLayout PROTO((int argc, char **argv)); … … 124 126 void QuitX PROTO((Display *display, char *message)); 125 127 Graphic *GetGraphic PROTO(()); 128 int GetPixelCount PROTO((int sock)); 126 129 127 130 int Center PROTO(()); … … 131 134 void Remap24 PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix)); 132 135 void Remap32 PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix)); 133 int LoadPicture PROTO(()); 136 int LoadPicture PROTO((int sock)); 137 134 138 KapaImageWidget *InitImage PROTO(()); 139 void FreeImage PROTO((KapaImageWidget *image)); 135 140 void SetImageSize PROTO((Section *section)); 136 int GetPixelCount PROTO(()); 141 137 142 void InitButtonSize PROTO((Button *button, int width, int height, char *bitmap)); 138 143 void InitButtonFunc PROTO((Button *button, int (*function)())); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CSaveOverlay.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int CSaveOverlay ( ) {3 int CSaveOverlay (int sock) { 4 4 5 5 char filename[256]; … … 10 10 KapaImageWidget *image; 11 11 12 KiiScanMessage (sock, "%*s %d %s", &N, filename); 13 12 14 section = GetActiveSection(); 13 15 image = section->image; 16 if (image == NULL) return (TRUE); 14 17 15 KiiScanMessage (sock, "%*s %d %s", &N, filename);16 17 18 f = fopen (filename, "w"); 18 19 if (f == NULL) { -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Center.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int Center ( ) {3 int Center (int sock) { 4 4 5 5 int zoom; … … 9 9 KapaImageWidget *image; 10 10 11 KiiScanMessage (sock, "%lf %lf %d", &X, &Y, &zoom); 12 11 13 graphic = GetGraphic(); 12 14 section = GetActiveSection(); 13 15 image = section->image; 14 15 KiiScanMessage (sock, "%lf %lf %d", &X, &Y, &zoom); 16 if (image == NULL) return (TRUE); 16 17 17 18 image[0].X = 0.5*image[0].matrix.Naxis[0] - X; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c
r13333 r13344 2 2 # define STRCONST(A) ((int)(0x1000000*A[0] + 0x10000*A[1] + 0x100*A[2] + 0x1*A[3])) 3 3 4 static KapaSockAddress Address; 5 static int InitSocket = -1; 6 static int sock = -1; 7 8 // we can supply a port here, with only small changes 9 void InitPipe () { 10 InitSocket = KapaServerInit (&Address); 11 return; 12 } 13 4 14 int CheckPipe () { 5 15 6 16 int status; 7 17 char buffer[32]; 18 19 // check if we have a valid connection. if not, see if we can get one 20 if (sock == -1) { 21 sock = KapaServerWait (InitSocket, &Address); 22 if (sock == -1) return (TRUE); 23 } 8 24 9 25 /***** read (4 byte) message word from socket ****/ … … 47 63 48 64 if (!strcmp (buffer, "PSIT")) { 49 status = PScommand ( );65 status = PScommand (sock); 50 66 write (sock, "DONE", 4); 51 67 return (status); … … 53 69 54 70 if (!strcmp (buffer, "PNGF")) { 55 status = PNGit ( );71 status = PNGit (sock); 56 72 write (sock, "DONE", 4); 57 73 return (status); … … 59 75 60 76 if (!strcmp (buffer, "PPMF")) { 61 status = PPMit ( );77 status = PPMit (sock); 62 78 write (sock, "DONE", 4); 63 79 return (status); … … 65 81 66 82 if (!strcmp (buffer, "DBOX")) { 67 status = LoadFrame ( );83 status = LoadFrame (sock); 68 84 return (status); 69 85 } 70 86 71 87 if (!strcmp (buffer, "PLOT")) { 72 status = LoadObject ( );88 status = LoadObject (sock); 73 89 return (status); 74 90 } 75 91 76 92 if (!strcmp (buffer, "LABL")) { 77 status = LoadLabels ( );93 status = LoadLabels (sock); 78 94 return (TRUE); 79 95 } 80 96 81 97 if (!strcmp (buffer, "PTXT")) { 82 status = LoadTextlines ( );98 status = LoadTextlines (sock); 83 99 return (TRUE); 84 100 } 85 101 86 102 if (!strcmp (buffer, "RSIZ")) { 87 status = Resize ( );103 status = Resize (sock); 88 104 return (status); 89 105 } 90 106 91 107 if (!strcmp (buffer, "LIMS")) { 92 GetLimits ( );108 GetLimits (sock); 93 109 return (TRUE); 94 110 } 95 111 96 112 if (!strcmp (buffer, "SLIM")) { 97 status = SetLimits ( );113 status = SetLimits (sock); 98 114 return (TRUE); 99 115 } 100 116 101 117 if (!strcmp (buffer, "SSEC")) { 102 status = SetSection ( );118 status = SetSection (sock); 103 119 return (TRUE); 104 120 } 105 121 106 122 if (!strcmp (buffer, "LSEC")) { 107 status = ListSection ( );123 status = ListSection (sock); 108 124 return (TRUE); 109 125 } 110 126 111 127 if (!strcmp (buffer, "DSEC")) { 112 status = DefineSection ( );128 status = DefineSection (sock); 113 129 return (TRUE); 114 130 } 115 131 116 132 if (!strcmp (buffer, "FONT")) { 117 status = SetFont ( );133 status = SetFont (sock); 118 134 return (TRUE); 119 135 } … … 121 137 /* Erase Section */ 122 138 if (!strcmp (buffer, "ERSC")) { 123 status = EraseCurrentPlot ( TRUE);139 status = EraseCurrentPlot (); 124 140 return (status); 125 141 } … … 127 143 /* Erase Section */ 128 144 if (!strcmp (buffer, "ERAS")) { 129 status = ErasePlots ( TRUE);145 status = ErasePlots (); 130 146 return (status); 131 147 } … … 133 149 /* Don't Erase Section */ 134 150 if (!strcmp (buffer, "ERSS")) { 135 status = EraseSections ( FALSE);151 status = EraseSections (); 136 152 return (status); 137 153 } … … 139 155 140 156 if (!strcmp (buffer, "READ")) { 141 status = LoadPicture ( );157 status = LoadPicture (sock); 142 158 return (status); 143 159 } … … 145 161 // XXX duplicate Command word 146 162 if (!strcmp (buffer, "ERAS")) { 147 status = EraseOverlay ( );163 status = EraseOverlay (sock); 148 164 return (status); 149 165 } 150 166 151 167 if (!strcmp (buffer, "LOAD")) { 152 status = LoadOverlay ( );168 status = LoadOverlay (sock); 153 169 return (status); 154 170 } 155 171 156 172 if (!strcmp (buffer, "TICK")) { 157 status = LoadTickmarks ( );173 status = LoadTickmarks (sock); 158 174 return (status); 159 175 } 160 176 161 177 if (!strcmp (buffer, "SAVE")) { 162 status = SaveOverlay ( );178 status = SaveOverlay (sock); 163 179 return (status); 164 180 } 165 181 166 182 if (!strcmp (buffer, "CSVE")) { 167 status = CSaveOverlay ( );183 status = CSaveOverlay (sock); 168 184 return (status); 169 185 } 170 186 171 187 if (!strcmp (buffer, "JPEG")) { 172 status = JPEGit24 ( );188 status = JPEGit24 (sock); 173 189 write (sock, "DONE", 4); 174 190 return (status); … … 176 192 177 193 if (!strcmp (buffer, "CENT")) { 178 status = Center ( );194 status = Center (sock); 179 195 return (status); 180 196 } 181 197 182 198 if (!strcmp (buffer, "NPIX")) { 183 GetPixelCount ( );199 GetPixelCount (sock); 184 200 return (TRUE); 185 201 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/DefineSection.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int DefineSection () { 3 // define the section, but do not create a graph or image 4 int DefineSection (int sock) { 4 5 5 6 int i, N, MoveSection; … … 15 16 if (N < 0) { 16 17 section = AddSection (name, x, y, dx, dy); 17 section->graph = InitGraph ();18 18 MoveSection = TRUE; 19 19 } else { … … 34 34 if (MoveSection) { 35 35 SetGraphSize (section); 36 SetImageSize (section); 36 37 Refresh (1); 37 38 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseCurrentPlot.c
r13320 r13344 11 11 section = GetActiveSection(); 12 12 if (section->graph == NULL) return (TRUE); 13 13 14 EraseGraph (section->graph); 14 15 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseOverlay.c
r13331 r13344 1 1 # include "Ximage.h" 2 2 3 int EraseOverlay ( ) {3 int EraseOverlay (int sock) { 4 4 5 5 char buffer[256]; … … 12 12 section = GetActiveSection(); 13 13 image = section->image; 14 if (image == NULL) return (TRUE); 14 15 15 16 KiiScanCommand (sock, 16, "%*s %d", &N); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/GetPixelCount.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int GetPixelCount ( ) {3 int GetPixelCount (int sock) { 4 4 5 5 int i; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Graphs.c
r13320 r13344 100 100 FREE (graph[0].objects); 101 101 FREE (graph[0].textline); 102 free (graph); 102 103 return; 103 104 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Image.c
r13331 r13344 145 145 FlushDisplay (graphic[0].display); 146 146 } 147 148 void FreeImage (KapaImageWidget *image) { 149 150 int i; 151 152 if (image == NULL) return; 153 154 for (i = 0; i < NOVERLAYS; i++) { 155 free (image[0].overlay[i].objects); 156 } 157 free (image[0].matrix.buffer); 158 free (image[0].picture.data); 159 free (image[0].cmapbar.data); 160 free (image[0].zoom.data); 161 162 free (image); 163 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretKeys.c
r13333 r13344 55 55 } 56 56 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 57 write (sock, line, 40); 57 // XXX need to do something different here 58 // xxx write (sock, line, 40); 58 59 } 59 60 60 61 skip_cursor: 62 if (image == NULL) return (TRUE); 63 61 64 // offset is in image pixels: 62 65 // 0.5 image pixels is 1 screen pixel for expand == +2 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/InterpretPresses.c
r13333 r13344 34 34 } 35 35 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 36 write (sock, line, 40); 36 // need to do something different here... 37 // xxx write (sock, line, 40); 37 38 } 38 39 … … 40 41 status = TRUE; 41 42 this_button = event[0].button; 43 44 // XXX add graph buttons here 45 if (image == NULL) return (TRUE); 42 46 43 47 if ((event[0].type == ButtonPress) && InPicture (event, &image[0].picture)) { -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/JPEGit24.c
r13320 r13344 6 6 # define WHITE_B 255 7 7 8 // XXX this currently writes out the jpeg for the active image9 int JPEGit24 ( ) {8 // XXX this currently writes out the jpeg for just the active image 9 int JPEGit24 (int sock) { 10 10 11 11 struct jpeg_compress_struct cinfo; … … 30 30 FILE *f; 31 31 32 /* expect a line telling the number of bytes and a filename */ 33 KiiScanMessage (sock, "%s", filename); 34 32 35 graphic = GetGraphic(); 33 36 section = GetActiveSection(); 34 37 image = section->image; 35 36 /* expect a line telling the number of bytes and a filename */ 37 KiiScanMessage (sock, "%s", filename); 38 if (image == NULL) return (TRUE); 38 39 39 40 /***** JPEG init calls */ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Layout.c
r13333 r13344 4 4 void InitLayout (int argc, char **argv) { 5 5 6 int N , UseGraph;6 int N; 7 7 Section *section; 8 8 9 UseGraph = FALSE; 10 if ((N = get_argument (argc, argv, "-image"))) { 11 remove_argument(N, &argc, argv); 12 UseGraph = FALSE; 13 } 14 15 /** initiate connection with server **/ 16 if (!FOREGROUND) { 17 if (argc < 2) { 18 fprintf (stderr, "socket path not specified\n"); 19 exit (0); 20 } 21 sock = KiiWait (argv[1]); 22 } 9 InitPipe(); 23 10 24 11 ACTIVE_CURSOR = FALSE; … … 37 24 } 38 25 26 /* move this out of here... */ 27 if (argc != 1) { 28 fprintf (stderr, "USAGE: kapa\n"); 29 exit (0); 30 } 31 39 32 InitRotFonts (); 40 33 41 /* create basic section */34 /* create basic section, empty of image or graph */ 42 35 section = AddSection ("default", 0.0, 0.0, 1.0, 1.0); 43 if (UseGraph) {44 section->graph = InitGraph ();45 SetGraphSize (section);46 } else {47 section->image = InitImage ();48 SetImageSize (section);49 }50 36 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadFrame.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int LoadFrame ( ) {3 int LoadFrame (int sock) { 4 4 5 5 int i, status; … … 9 9 10 10 section = GetActiveSection(); 11 if (section->graph == NULL) { 12 section->graph = InitGraph (); 13 SetGraphSize (section); 14 } 11 15 graph = section->graph; 12 16 13 // XXX what to do if graph is NULL?14 15 17 KiiScanMessage (sock, "%lf %lf %lf %lf", 16 18 &graph[0].axis[0].min, &graph[0].axis[0].max, -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadLabels.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int LoadLabels ( ) {3 int LoadLabels (int sock) { 4 4 5 5 char *c, *label; … … 9 9 10 10 section = GetActiveSection(); 11 if (section->graph == NULL) { 12 section->graph = InitGraph (); 13 SetGraphSize (section); 14 } 11 15 graph = section->graph; 12 16 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadObject.c
r13320 r13344 2 2 # include <errno.h> 3 3 4 int LoadObject ( ) {4 int LoadObject (int sock) { 5 5 6 6 int N; … … 9 9 10 10 section = GetActiveSection(); 11 if (section->graph == NULL) { 12 section->graph = InitGraph (); 13 SetGraphSize (section); 14 } 11 15 graph = section->graph; 12 16 … … 44 48 fcntl (sock, F_SETFL, O_NONBLOCK); 45 49 46 if (!LoadVectorData ( graph, N, "x")) {50 if (!LoadVectorData (sock, graph, N, "x")) { 47 51 FreeObjectData (&graph[0].objects[N]); 48 52 graph[0].Nobjects --; … … 50 54 } 51 55 52 if (!LoadVectorData ( graph, N, "y")) {56 if (!LoadVectorData (sock, graph, N, "y")) { 53 57 FreeObjectData (&graph[0].objects[N]); 54 58 graph[0].Nobjects --; … … 56 60 } 57 61 if (graph[0].objects[N].size < 0.0) { 58 if (!LoadVectorData ( graph, N, "z")) {62 if (!LoadVectorData (sock, graph, N, "z")) { 59 63 FreeObjectData (&graph[0].objects[N]); 60 64 graph[0].Nobjects --; … … 63 67 } 64 68 if (graph[0].objects[N].etype & 0x01) { 65 if (!LoadVectorData ( graph, N, "dym")) {69 if (!LoadVectorData (sock, graph, N, "dym")) { 66 70 FreeObjectData (&graph[0].objects[N]); 67 71 graph[0].Nobjects --; 68 72 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 69 73 } 70 if (!LoadVectorData ( graph, N, "dyp")) {74 if (!LoadVectorData (sock, graph, N, "dyp")) { 71 75 FreeObjectData (&graph[0].objects[N]); 72 76 graph[0].Nobjects --; … … 75 79 } 76 80 if (graph[0].objects[N].etype & 0x02) { 77 if (!LoadVectorData ( graph, N, "dxm")) {81 if (!LoadVectorData (sock, graph, N, "dxm")) { 78 82 FreeObjectData (&graph[0].objects[N]); 79 83 graph[0].Nobjects --; 80 84 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 81 85 } 82 if (!LoadVectorData ( graph, N, "dxp")) {86 if (!LoadVectorData (sock, graph, N, "dxp")) { 83 87 FreeObjectData (&graph[0].objects[N]); 84 88 graph[0].Nobjects --; … … 97 101 98 102 /* load data for the named component */ 99 int LoadVectorData ( KapaGraphWidget *graph, int N, char *type) {103 int LoadVectorData (int sock, KapaGraphWidget *graph, int N, char *type) { 100 104 101 105 int Npts, Ninpts, status, Ntry; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadOverlay.c
r13331 r13344 2 2 3 3 // XXX this is a very inefficient method to send the data: binary would be better 4 int LoadOverlay ( ) {4 int LoadOverlay (int sock) { 5 5 6 6 char word[17], type[16], string[128]; … … 15 15 graphic = GetGraphic (); 16 16 section = GetActiveSection(); 17 if (section->image == NULL) { 18 section->image = InitImage (); 19 SetImageSize (section); 20 } 17 21 image = section->image; 18 22 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadPicture.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int LoadPicture ( ) {3 int LoadPicture (int sock) { 4 4 5 5 Header header; … … 12 12 graphic = GetGraphic (); 13 13 section = GetActiveSection(); 14 image = section->image; 14 if (section->image == NULL) { 15 section->image = InitImage (); 16 SetImageSize (section); 17 } 18 image = section->image; 15 19 16 20 KiiSendMessage (sock, "%d", graphic->Npixels); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTextlines.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int LoadTextlines ( ) {3 int LoadTextlines (int sock) { 4 4 5 5 char *string; … … 11 11 section = GetActiveSection(); 12 12 graph = section->graph; 13 13 if (section->graph == NULL) { 14 section->graph = InitGraph (); 15 SetGraphSize (section); 16 } 17 14 18 fcntl (sock, F_SETFL, !O_NONBLOCK); 15 19 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTickmarks.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int LoadTickmarks ( ) {3 int LoadTickmarks (int sock) { 4 4 5 5 char line[129], type[16]; … … 10 10 11 11 section = GetActiveSection(); 12 if (section->image == NULL) { 13 section->image = InitImage (); 14 SetImageSize (section); 15 } 12 16 image = section->image; 17 13 18 fcntl (sock, F_SETFL, !O_NONBLOCK); 14 19 … … 63 68 fcntl (sock, F_SETFL, O_NONBLOCK); 64 69 return (TRUE); 65 66 70 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PNGit.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int PNGit ( ) {3 int PNGit (int sock) { 4 4 5 5 FILE *f; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PPMit.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int PPMit ( ) {3 int PPMit (int sock) { 4 4 5 5 FILE *f; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PSit.c
r13331 r13344 6 6 static Graphic *graphic; 7 7 8 int PScommand ( ) {8 int PScommand (int sock) { 9 9 10 10 int status, scaleMode, pageMode; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Resize.c
r13320 r13344 2 2 3 3 // XXX Should there be a base command + KiiMessage command? 4 int Resize ( ) {4 int Resize (int sock) { 5 5 6 6 int i, Nsection; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SaveOverlay.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int SaveOverlay ( ) {3 int SaveOverlay (int sock) { 4 4 5 5 int i, N; … … 11 11 section = GetActiveSection(); 12 12 image = section->image; 13 if (image == NULL) return (TRUE); 13 14 14 15 KiiScanMessage (sock, "%*s %d %s", &N, filename); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Sections.c
r13320 r13344 24 24 25 25 if (section == NULL) return; 26 if (section[0].graph != NULL)FreeGraph (section[0].graph);27 // if (section[0].image != NULL)FreeImage (section[0].image);28 if (section[0].name != NULL) free(section[0].name);26 FreeGraph (section[0].graph); 27 FreeImage (section[0].image); 28 FREE (section[0].name); 29 29 free (section); 30 30 } … … 42 42 } 43 43 44 // XXX how to set the section type?45 // XXX set active section on Add?46 44 Section *AddSection (char *name, float x, float y, float dx, float dy) { 47 45 … … 116 114 } 117 115 118 int ListSection ( ) {116 int ListSection (int sock) { 119 117 120 118 int i, ThisSection; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetFont.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int SetFont ( ) {3 int SetFont (int sock) { 4 4 5 5 char name[64]; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetLimits.c
r13320 r13344 1 1 # include "Ximage.h" 2 2 3 int SetLimits ( ) {3 int SetLimits (int sock) { 4 4 5 5 int i; … … 14 14 15 15 section = GetActiveSection(); 16 if (section->graph == NULL) return (TRUE); 16 if (section->graph == NULL) { 17 section->graph = InitGraph (); 18 SetGraphSize (section); 19 } 17 20 graph = section->graph; 18 21 19 22 graph[0].axis[2].min = graph[0].axis[0].min = xmin; 20 23 graph[0].axis[2].max = graph[0].axis[0].max = xmax; … … 32 35 Refresh (1); 33 36 34 return (TRUE); 35 37 return (TRUE); 36 38 } 37 39 38 int GetLimits ( ) {40 int GetLimits (int sock) { 39 41 40 42 double dX, dY; … … 57 59 return (TRUE); 58 60 } 61 62 /* example for image: 63 64 section->image = InitImage (); 65 SetImageSize (section); 66 */ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetSection.c
r13320 r13344 2 2 3 3 // set active section 4 int SetSection ( ) {4 int SetSection (int sock) { 5 5 6 6 int N; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/UpdatePointer.c
r13320 r13344 13 13 section = GetActiveSection(); 14 14 image = section->image; 15 if (image == NULL) return (TRUE); 15 16 16 17 if (image[0].MovePointer && InPicture ((XButtonEvent *)event, &image[0].picture)) { -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/kapa.c
r13320 r13344 7 7 SetUpGraphic (&argc, argv); 8 8 9 // XXX get socket connection here?10 11 9 InitLayout (argc, argv); 12 10 EventLoop (); -
branches/kapa-mods-2007-05/Ohana/src/libkapa/Makefile
r12879 r13344 29 29 $(SRC)/KiiConvert.$(ARCH).o \ 30 30 $(SRC)/KapaWindow.$(ARCH).o \ 31 $(SRC)/KapaColors.$(ARCH).o 31 $(SRC)/KapaColors.$(ARCH).o \ 32 $(SRC)/KapaOpen.$(ARCH).o 32 33 33 34 DRAW = \ -
branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h
r13334 r13344 2 2 # define KAPA_H 3 3 4 /* linux is happy with this, not solaris */ 5 # include <netinet/ip.h> 6 # include <netdb.h> 7 # include <arpa/inet.h> 8 9 # include <sys/types.h> 10 # include <sys/socket.h> 4 11 # include <X11/Xlib.h> 5 12 # include <png.h> 6 13 # include <dvo.h> 14 15 typedef struct sockaddr_in KapaSockAddress; 7 16 8 17 typedef struct { … … 196 205 int bDrawRotBitmap (int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale); 197 206 207 /* Kapa Socket functions */ 208 int KapaOpen (char *kapa_exec, char *kapa_name); 209 int KapaServerInit (KapaSockAddress *Address); 210 int KapaServerWait (int InitSocket, KapaSockAddress *Address); 211 int KapaDefineValidIP (char *ipstring); 212 int KapaClientSocket (char *hostname); 213 198 214 /* define Kapa names for shared functions */ 199 # define KapaOpen(p,n) KiiOpen(p,n)215 // # define KapaOpen(p,n) KiiOpen(p,n) 200 216 # define KapaResize(fd,Nx,Ny) KiiResize(fd,Nx,Ny) 201 217 # define KapaCenter(fd,x,y,z) KiiResize(fd,x,y,z) -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/IOfuncs.c
r13334 r13344 111 111 int KiiScanCommand (int device, int length, char *format, ...) { 112 112 113 int Nbytes,status;114 char * buffer, *message;113 int status; 114 char *message; 115 115 va_list argp; 116 116 … … 118 118 119 119 /* read Nbytes from the device */ 120 status = read (device, message, Nbytes);121 if (status != Nbytes) fprintf (stderr, "Kii/Kapa comm error\n");120 status = read (device, message, length); 121 if (status != length) fprintf (stderr, "Kii/Kapa comm error\n"); 122 122 message[status] = 0; 123 123 /* make the string easy to parse */ … … 125 125 /* scan the incoming message */ 126 126 va_start (argp, format); 127 Nbytes = vsscanf (message, format, argp);127 status = vsscanf (message, format, argp); 128 128 va_end (argp); 129 129 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/close.c
r6686 r13344 24 24 if (IsImage) { 25 25 if (!GetImage (&Source, &Nsource)) return (FALSE); 26 close_image (Nsource);26 // close_image (Nsource); 27 27 } else { 28 28 if (!GetGraph (NULL, &Source, &Nsource)) return (FALSE); 29 close_graph (Nsource);29 // close_graph (Nsource); 30 30 } 31 31 -
branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h
r12332 r13344 4 4 # ifndef DISPLAY_H 5 5 # define DISPLAY_H 6 7 # if (0)8 typedef struct {9 double xmin, xmax, ymin, ymax;10 int style, ptype, ltype, etype, ebar, color;11 double lweight, size;12 Coords coords;13 int flipeast, flipnorth;14 char axis[8], labels[8], ticks[8];15 } Graphdata;16 # endif17 6 18 7 /*** plotting functions ***/ … … 45 34 int SelectOverlay PROTO((char *name, int *number)); 46 35 36 void InitKapa (); 37 int FindKapaDevice (int thisDevice); 38 int open_kapa (int thisDevice); 39 47 40 /* calling program need to define a function 'get_variable' which 48 41 * returns the name of the executable for each of KAPA and KII -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/Makefile
r12879 r13344 29 29 $(SDIR)/gaussian.$(ARCH).o \ 30 30 $(SDIR)/graphtools.$(ARCH).o \ 31 $(SDIR)/open_graph.$(ARCH).o \32 $(SDIR)/open_image.$(ARCH).o \33 31 $(SDIR)/queues.$(ARCH).o \ 34 32 $(SDIR)/PlotVectors.$(ARCH).o \ 33 $(SDIR)/open_kapa.$(ARCH).o \ 35 34 $(SDIR)/style_args.$(ARCH).o 35 36 #$(SDIR)/open_graph.$(ARCH).o \ 37 #$(SDIR)/open_image.$(ARCH).o \ 36 38 37 39 # dependancy rules for include files ######################## -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_image.c
r7938 r13344 122 122 return (Ximbuffer[Active]); 123 123 } 124 124 125 // leave this information on kapa, request when needed? 125 126 void SetImageScale (double zero, double range) { 126 127 Xzero[Active] = zero; -
branches/kapa-mods-2007-05/Ohana/src/opihi/mana/mana.c.in
r12280 r13344 51 51 /* add program-dependent exit functions here */ 52 52 void cleanup () { 53 QuitImage ();54 QuitGraph ();53 // QuitImage (); 54 // QuitGraph (); 55 55 return; 56 56 }
Note:
See TracChangeset
for help on using the changeset viewer.
