Changeset 13479 for trunk/Ohana/src/kapa2
- Timestamp:
- May 22, 2007, 12:23:09 PM (19 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 5 added
- 57 edited
-
Makefile (modified) (5 diffs)
-
include/constants.h (modified) (1 diff)
-
include/globals.h (modified) (1 diff)
-
include/prototypes.h (modified) (5 diffs)
-
include/structures.h (modified) (4 diffs)
-
src/CSaveOverlay.c (modified) (4 diffs)
-
src/Center.c (modified) (2 diffs)
-
src/CheckPipe.c (modified) (2 diffs)
-
src/CheckVisual.c (modified) (2 diffs)
-
src/CreatePicture.c (modified) (1 diff)
-
src/CreateZoom16.c (modified) (6 diffs)
-
src/CreateZoom24.c (modified) (5 diffs)
-
src/CreateZoom32.c (modified) (5 diffs)
-
src/CreateZoom8.c (modified) (6 diffs)
-
src/DefineSection.c (modified) (3 diffs)
-
src/EraseCurrentPlot.c (modified) (1 diff)
-
src/EraseImage.c (added)
-
src/EraseOverlay.c (modified) (2 diffs)
-
src/GetPixelCount.c (modified) (1 diff)
-
src/Graphs.c (modified) (2 diffs)
-
src/Image.c (modified) (5 diffs)
-
src/InterpretKeys.c (modified) (4 diffs)
-
src/InterpretPresses.c (modified) (4 diffs)
-
src/JPEGit24.c (modified) (5 diffs)
-
src/Layout.c (modified) (2 diffs)
-
src/LoadFrame.c (modified) (3 diffs)
-
src/LoadLabels.c (modified) (3 diffs)
-
src/LoadObject.c (modified) (11 diffs)
-
src/LoadOverlay.c (modified) (2 diffs)
-
src/LoadPicture.c (modified) (3 diffs)
-
src/LoadTextlines.c (modified) (3 diffs)
-
src/LoadTickmarks.c (modified) (3 diffs)
-
src/PNGit.c (modified) (1 diff)
-
src/PPMit.c (modified) (1 diff)
-
src/PSOverlay.c (modified) (1 diff)
-
src/PSit.c (modified) (1 diff)
-
src/PaintOverlay.c (modified) (1 diff)
-
src/PaintTickmarks.c (modified) (1 diff)
-
src/Reconfig.c (modified) (1 diff)
-
src/Refresh.c (modified) (1 diff)
-
src/Remap16.c (modified) (6 diffs)
-
src/Remap24.c (modified) (6 diffs)
-
src/Remap32.c (modified) (5 diffs)
-
src/Remap8.c (modified) (5 diffs)
-
src/Resize.c (modified) (2 diffs)
-
src/SaveOverlay.c (modified) (4 diffs)
-
src/Sections.c (modified) (4 diffs)
-
src/SetFont.c (modified) (1 diff)
-
src/SetGraphData.c (added)
-
src/SetGraphSize.c (modified) (2 diffs)
-
src/SetGraphStyle.c (added)
-
src/SetImageData.c (added)
-
src/SetImageSize.c (modified) (2 diffs)
-
src/SetLimits.c (modified) (3 diffs)
-
src/SetNormalHints.c (modified) (1 diff)
-
src/SetSection.c (modified) (1 diff)
-
src/SetToolbox.c (added)
-
src/UpdatePointer.c (modified) (4 diffs)
-
src/UpdateStatusBox.c (modified) (4 diffs)
-
src/bDrawIt.c (modified) (1 diff)
-
src/bDrawOverlay.c (modified) (2 diffs)
-
src/kapa.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/Makefile
r13333 r13479 1 default: kapa 21 default: kapa 2 2 help: 3 3 @echo "make options: kapa (default)" … … 20 20 INDEPS = $(DESTINC)/kapa.h $(DESTINC)/dvo.h $(DESTINC)/gfitsio.h $(DESTINC)/ohana.h 21 21 22 kapa2: $(BIN)/kapa 2.$(ARCH)23 install: $(DESTBIN)/kapa 222 kapa2: $(BIN)/kapa.$(ARCH) 23 install: $(DESTBIN)/kapa 24 24 25 25 KAPA = \ … … 49 49 $(SRC)/Graphs.$(ARCH).o $(SRC)/SetGraphSize.$(ARCH).o \ 50 50 $(SRC)/Resize.$(ARCH).o $(SRC)/ErasePlots.$(ARCH).o \ 51 $(SRC)/EraseImage.$(ARCH).o $(SRC)/SetToolbox.$(ARCH).o \ 51 52 $(SRC)/EraseCurrentPlot.$(ARCH).o $(SRC)/EraseSections.$(ARCH).o \ 52 53 $(SRC)/SetSection.$(ARCH).o $(SRC)/DefineSection.$(ARCH).o \ … … 64 65 $(SRC)/CreatePicture.$(ARCH).o $(SRC)/CreateColorbar.$(ARCH).o \ 65 66 $(SRC)/MakeColormap.$(ARCH).o $(SRC)/SetColormap.$(ARCH).o \ 66 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/ PaintTickmarks.$(ARCH).o\67 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/SetGraphData.$(ARCH).o \ 67 68 $(SRC)/LoadOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 68 $(SRC)/ LoadTickmarks.$(ARCH).o $(SRC)/SaveOverlay.$(ARCH).o\69 $(SRC)/SaveOverlay.$(ARCH).o $(SRC)/SetImageData.$(ARCH).o \ 69 70 $(SRC)/CSaveOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 70 71 $(SRC)/CheckVisual.$(ARCH).o $(SRC)/CursorOps.$(ARCH).o \ … … 88 89 $(OBJ): $(INDEPS) $(LDDEPS) 89 90 90 $(BIN)/kapa 2.$(ARCH): $(OBJ)91 $(BIN)/kapa.$(ARCH): $(OBJ) -
trunk/Ohana/src/kapa2/include/constants.h
r13320 r13479 10 10 | PointerMotionMask) 11 11 12 # define PAD1 513 # define PAD2 312 # define PAD1 3 13 # define PAD2 5 14 14 # define TEXTPAD 25 15 15 # define COLORPAD 10 16 16 # define TEXT_Y 15 17 # define ZOOM_X 1 7018 # define ZOOM_Y 1 7017 # define ZOOM_X 152 18 # define ZOOM_Y 152 19 19 # define NOVERLAYS 4 20 20 # define BUTTON_WIDTH 28 -
trunk/Ohana/src/kapa2/include/globals.h
r13333 r13479 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 -
trunk/Ohana/src/kapa2/include/prototypes.h
r13333 r13479 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 MoveSection PROTO((int sock)); 59 int DefineSection PROTO((int sock)); 60 int SetFont PROTO((int sock)); 61 int EraseCurrentPlot PROTO((void)); 62 int ErasePlots PROTO((void)); 63 int EraseSections PROTO((void)); 64 int EraseImage PROTO((void)); 65 int SetGraphData PROTO((int sock)); 66 int GetGraphData PROTO((int sock)); 67 int SetImageData PROTO((int sock)); 68 int GetImageData PROTO((int sock)); 69 70 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); 64 71 65 72 /* Section Utilities */ … … 74 81 Section *GetActiveSection PROTO(()); 75 82 int SetActiveSectionByNumber PROTO((int N)); 76 int ListSection PROTO(( ));83 int ListSection PROTO((int sock)); 77 84 78 85 KapaGraphWidget *InitGraph PROTO(()); 79 86 void DrawGraph PROTO((KapaGraphWidget *graph)); 80 87 void SetGraphSize PROTO((Section *section)); 88 void FreeGraph PROTO((KapaGraphWidget *graph)); 81 89 82 90 void InitLayout PROTO((int argc, char **argv)); … … 124 132 void QuitX PROTO((Display *display, char *message)); 125 133 Graphic *GetGraphic PROTO(()); 134 int GetPixelCount PROTO((int sock)); 126 135 127 136 int Center PROTO(()); … … 131 140 void Remap24 PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix)); 132 141 void Remap32 PROTO((Graphic *graphic, KapaImageWidget *image, Matrix *matrix)); 133 int LoadPicture PROTO(()); 142 int LoadPicture PROTO((int sock)); 143 134 144 KapaImageWidget *InitImage PROTO(()); 145 void FreeImage PROTO((KapaImageWidget *image)); 135 146 void SetImageSize PROTO((Section *section)); 136 int GetPixelCount PROTO(()); 147 137 148 void InitButtonSize PROTO((Button *button, int width, int height, char *bitmap)); 138 149 void InitButtonFunc PROTO((Button *button, int (*function)())); -
trunk/Ohana/src/kapa2/include/structures.h
r13320 r13479 95 95 int Nobjects; 96 96 unsigned long color; 97 Object*objects;97 KiiOverlay *objects; 98 98 } Overlay; 99 99 … … 116 116 Axis axis[4]; /* coordinate axes */ 117 117 Label label[8]; /* fixed axis labels */ 118 Graphdata data; /* current graph data */ 118 119 119 120 Gobjects *objects; /* graphic objects */ … … 138 139 Button grey_button; 139 140 Button rainbow_button; 140 Button puns_button;141 Button puns_button; 141 142 Button overlay_button[NOVERLAYS]; 142 143 143 144 // location of the status box 144 145 int text_x, text_y; 146 int text_dx, text_dy; 145 147 int location; // position of the zoom/status widgets (0 = none, 1-4 = bottom,left,top,right) 146 148 int MovePointer; … … 159 161 Coords coords; 160 162 char file[1024]; /* name of file */ 161 char buffer_name[1024]; /* name of buffer */163 char name[1024]; /* name of buffer */ 162 164 } KapaImageWidget; 163 165 -
trunk/Ohana/src/kapa2/src/CSaveOverlay.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int CSaveOverlay ( ) {3 int CSaveOverlay (int sock) { 4 4 5 char filename[256] ;5 char filename[256], *type; 6 6 int i, N; 7 7 double ra, dec, ra1, dec1, x1, y1, dra, ddec; … … 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) { … … 22 23 23 24 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 24 if ( !strcmp (image[0].overlay[N].objects[i].type, "LINE")) {25 if (image[0].overlay[N].objects[i].type == KII_OVERLAY_LINE) { 25 26 XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].coords); 26 27 x1 = image[0].overlay[N].objects[i].x + image[0].overlay[N].objects[i].dx; … … 40 41 dra = cos (dec*RAD_DEG) * fabs (ra1 - ra); 41 42 } 42 fprintf (f, "%s %lf %lf %lf %lf\n", image[0].overlay[N].objects[i].type, ra, dec, dra, ddec); 43 type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type); 44 if (type == NULL) continue; 45 fprintf (f, "%s %lf %lf %lf %lf\n", type, ra, dec, dra, ddec); 43 46 } 44 47 fclose (f); -
trunk/Ohana/src/kapa2/src/Center.c
r13320 r13479 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; -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r13333 r13479 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 14 int GetActiveSocket () { 15 return (sock); 16 } 17 18 // after we have processed the command, we unblock the socket 19 # define FINISHED(A) { fcntl (sock, F_SETFL, O_NONBLOCK); return (A); } 20 4 21 int CheckPipe () { 5 22 6 23 int status; 7 char buffer[32]; 24 char word[5]; 25 26 // check if we have a valid connection. if not, see if we can get one 27 if (sock == -1) { 28 sock = KapaServerWait (InitSocket, &Address); 29 if (sock == -1) return (TRUE); 30 close (InitSocket); /* stop listening for new connections */ 31 fcntl (sock, F_SETFL, O_NONBLOCK); 32 } 8 33 9 34 /***** read (4 byte) message word from socket ****/ 10 status = read (sock, buffer, 4);11 buffer[4] = 0;35 status = read (sock, word, 4); 36 word[4] = 0; 12 37 switch (status) { 13 38 case -1: /* no input from pipe: continue */ … … 29 54 } 30 55 56 /* once we get a command, we block to ensure we get complete messages */ 57 fcntl (sock, F_SETFL, !O_NONBLOCK); 58 31 59 /***** handle different messages ****/ 32 60 if (ACTIVE_CURSOR) { 33 if (strcmp (buffer, "NCUR")) { 34 fprintf (stderr, "wrong end message %s\n", buffer); 35 return (TRUE); 61 if (strcmp (word, "NCUR")) { 62 fprintf (stderr, "wrong end message %s\n", word); 63 KiiSendCommand (sock, 4, "DONE"); 64 FINISHED (TRUE); 36 65 } 37 66 ACTIVE_CURSOR = FALSE; 38 return (TRUE); 67 KiiSendCommand (sock, 4, "DONE"); 68 FINISHED (TRUE); 39 69 } 40 70 41 if (!strcmp ( buffer, "QUIT")) return(FALSE);42 43 if (!strcmp ( buffer, "CURS")) {71 if (!strcmp (word, "QUIT")) FINISHED (FALSE); 72 73 if (!strcmp (word, "CURS")) { 44 74 ACTIVE_CURSOR = TRUE; 45 return (TRUE); 46 } 47 48 if (!strcmp (buffer, "PSIT")) { 49 status = PScommand (); 50 write (sock, "DONE", 4); 51 return (status); 52 } 53 54 if (!strcmp (buffer, "PNGF")) { 55 status = PNGit (); 56 write (sock, "DONE", 4); 57 return (status); 58 } 59 60 if (!strcmp (buffer, "PPMF")) { 61 status = PPMit (); 62 write (sock, "DONE", 4); 63 return (status); 64 } 65 66 if (!strcmp (buffer, "DBOX")) { 67 status = LoadFrame (); 68 return (status); 69 } 70 71 if (!strcmp (buffer, "PLOT")) { 72 status = LoadObject (); 73 return (status); 74 } 75 76 if (!strcmp (buffer, "LABL")) { 77 status = LoadLabels (); 78 return (TRUE); 79 } 80 81 if (!strcmp (buffer, "PTXT")) { 82 status = LoadTextlines (); 83 return (TRUE); 84 } 85 86 if (!strcmp (buffer, "RSIZ")) { 87 status = Resize (); 88 return (status); 89 } 90 91 if (!strcmp (buffer, "LIMS")) { 92 GetLimits (); 93 return (TRUE); 94 } 95 96 if (!strcmp (buffer, "SLIM")) { 97 status = SetLimits (); 98 return (TRUE); 99 } 100 101 if (!strcmp (buffer, "SSEC")) { 102 status = SetSection (); 103 return (TRUE); 104 } 105 106 if (!strcmp (buffer, "LSEC")) { 107 status = ListSection (); 108 return (TRUE); 109 } 110 111 if (!strcmp (buffer, "DSEC")) { 112 status = DefineSection (); 113 return (TRUE); 114 } 115 116 if (!strcmp (buffer, "FONT")) { 117 status = SetFont (); 118 return (TRUE); 75 KiiSendCommand (sock, 4, "DONE"); 76 FINISHED (TRUE); 77 } 78 79 if (!strcmp (word, "PSIT")) { 80 status = PScommand (sock); 81 KiiSendCommand (sock, 4, "DONE"); 82 FINISHED (status); 83 } 84 85 if (!strcmp (word, "PNGF")) { 86 status = PNGit (sock); 87 KiiSendCommand (sock, 4, "DONE"); 88 FINISHED (status); 89 } 90 91 if (!strcmp (word, "PPMF")) { 92 status = PPMit (sock); 93 KiiSendCommand (sock, 4, "DONE"); 94 FINISHED (status); 95 } 96 97 if (!strcmp (word, "DBOX")) { 98 status = LoadFrame (sock); 99 KiiSendCommand (sock, 4, "DONE"); 100 FINISHED (status); 101 } 102 103 if (!strcmp (word, "PLOT")) { 104 status = LoadObject (sock); 105 // LoadObject sends its own handshake 106 // KiiSendCommand (sock, 4, "DONE"); 107 FINISHED (status); 108 } 109 110 if (!strcmp (word, "LABL")) { 111 status = LoadLabels (sock); 112 KiiSendCommand (sock, 4, "DONE"); 113 FINISHED (TRUE); 114 } 115 116 if (!strcmp (word, "PTXT")) { 117 status = LoadTextlines (sock); 118 KiiSendCommand (sock, 4, "DONE"); 119 FINISHED (TRUE); 120 } 121 122 if (!strcmp (word, "RSIZ")) { 123 status = Resize (sock); 124 KiiSendCommand (sock, 4, "DONE"); 125 FINISHED (status); 126 } 127 128 if (!strcmp (word, "GLIM")) { 129 GetLimits (sock); 130 KiiSendCommand (sock, 4, "DONE"); 131 FINISHED (TRUE); 132 } 133 134 if (!strcmp (word, "SLIM")) { 135 status = SetLimits (sock); 136 KiiSendCommand (sock, 4, "DONE"); 137 FINISHED (TRUE); 138 } 139 140 if (!strcmp (word, "GSTY")) { 141 GetGraphData (sock); 142 KiiSendCommand (sock, 4, "DONE"); 143 FINISHED (TRUE); 144 } 145 146 if (!strcmp (word, "SSTY")) { 147 status = SetGraphData (sock); 148 KiiSendCommand (sock, 4, "DONE"); 149 FINISHED (TRUE); 150 } 151 152 if (!strcmp (word, "GIMD")) { 153 GetImageData (sock); 154 KiiSendCommand (sock, 4, "DONE"); 155 FINISHED (TRUE); 156 } 157 158 if (!strcmp (word, "SIMD")) { 159 status = SetImageData (sock); 160 KiiSendCommand (sock, 4, "DONE"); 161 FINISHED (TRUE); 162 } 163 164 if (!strcmp (word, "TOOL")) { 165 status = SetToolbox (sock); 166 KiiSendCommand (sock, 4, "DONE"); 167 FINISHED (TRUE); 168 } 169 170 if (!strcmp (word, "SSEC")) { 171 status = SetSection (sock); 172 KiiSendCommand (sock, 4, "DONE"); 173 FINISHED (TRUE); 174 } 175 176 if (!strcmp (word, "LSEC")) { 177 status = ListSection (sock); 178 KiiSendCommand (sock, 4, "DONE"); 179 FINISHED (TRUE); 180 } 181 182 if (!strcmp (word, "DSEC")) { 183 status = DefineSection (sock); 184 KiiSendCommand (sock, 4, "DONE"); 185 FINISHED (TRUE); 186 } 187 188 if (!strcmp (word, "MSEC")) { 189 status = MoveSection (sock); 190 KiiSendCommand (sock, 4, "DONE"); 191 FINISHED (TRUE); 192 } 193 194 if (!strcmp (word, "FONT")) { 195 status = SetFont (sock); 196 KiiSendCommand (sock, 4, "DONE"); 197 FINISHED (TRUE); 119 198 } 120 199 121 200 /* Erase Section */ 122 if (!strcmp (buffer, "ERSC")) { 123 status = EraseCurrentPlot (TRUE); 124 return (status); 125 } 126 127 /* Erase Section */ 128 if (!strcmp (buffer, "ERAS")) { 129 status = ErasePlots (TRUE); 130 return (status); 131 } 132 133 /* Don't Erase Section */ 134 if (!strcmp (buffer, "ERSS")) { 135 status = EraseSections (FALSE); 136 return (status); 137 } 138 139 140 if (!strcmp (buffer, "READ")) { 141 status = LoadPicture (); 142 return (status); 143 } 144 145 // XXX duplicate Command word 146 if (!strcmp (buffer, "ERAS")) { 147 status = EraseOverlay (); 148 return (status); 149 } 150 151 if (!strcmp (buffer, "LOAD")) { 152 status = LoadOverlay (); 153 return (status); 154 } 155 156 if (!strcmp (buffer, "TICK")) { 157 status = LoadTickmarks (); 158 return (status); 159 } 160 161 if (!strcmp (buffer, "SAVE")) { 162 status = SaveOverlay (); 163 return (status); 164 } 165 166 if (!strcmp (buffer, "CSVE")) { 167 status = CSaveOverlay (); 168 return (status); 169 } 170 171 if (!strcmp (buffer, "JPEG")) { 172 status = JPEGit24 (); 173 write (sock, "DONE", 4); 174 return (status); 175 } 176 177 if (!strcmp (buffer, "CENT")) { 178 status = Center (); 179 return (status); 180 } 181 182 if (!strcmp (buffer, "NPIX")) { 183 GetPixelCount (); 184 return (TRUE); 185 } 186 187 fprintf (stderr, "unknown signal %s\n", buffer); 188 189 return (TRUE); 190 201 if (!strcmp (word, "ERSC")) { 202 status = EraseCurrentPlot (); 203 KiiSendCommand (sock, 4, "DONE"); 204 FINISHED (status); 205 } 206 207 /* Erase Plots */ 208 if (!strcmp (word, "ERSP")) { 209 status = ErasePlots (); 210 KiiSendCommand (sock, 4, "DONE"); 211 FINISHED (status); 212 } 213 214 /* Erase Sections */ 215 if (!strcmp (word, "ERSS")) { 216 status = EraseSections (); 217 KiiSendCommand (sock, 4, "DONE"); 218 FINISHED (status); 219 } 220 221 /* Erase Image */ 222 if (!strcmp (word, "ERSI")) { 223 status = EraseImage (); 224 KiiSendCommand (sock, 4, "DONE"); 225 FINISHED (status); 226 } 227 228 /* Erase Overlay for this section */ 229 if (!strcmp (word, "ERSO")) { 230 status = EraseOverlay (sock); 231 KiiSendCommand (sock, 4, "DONE"); 232 FINISHED (status); 233 } 234 235 if (!strcmp (word, "READ")) { 236 status = LoadPicture (sock); 237 KiiSendCommand (sock, 4, "DONE"); 238 FINISHED (status); 239 } 240 241 if (!strcmp (word, "LOAD")) { 242 status = LoadOverlay (sock); 243 KiiSendCommand (sock, 4, "DONE"); 244 FINISHED (status); 245 } 246 247 if (!strcmp (word, "SAVE")) { 248 status = SaveOverlay (sock); 249 KiiSendCommand (sock, 4, "DONE"); 250 FINISHED (status); 251 } 252 253 if (!strcmp (word, "CSVE")) { 254 status = CSaveOverlay (sock); 255 KiiSendCommand (sock, 4, "DONE"); 256 FINISHED (status); 257 } 258 259 if (!strcmp (word, "JPEG")) { 260 status = JPEGit24 (sock); 261 KiiSendCommand (sock, 4, "DONE"); 262 FINISHED (status); 263 } 264 265 if (!strcmp (word, "CENT")) { 266 status = Center (sock); 267 KiiSendCommand (sock, 4, "DONE"); 268 FINISHED (status); 269 } 270 271 if (!strcmp (word, "NPIX")) { 272 GetPixelCount (sock); 273 KiiSendCommand (sock, 4, "DONE"); 274 FINISHED (TRUE); 275 } 276 277 fprintf (stderr, "unknown signal %s\n", word); 278 KiiSendCommand (sock, 4, "DONE"); 279 FINISHED (TRUE); 191 280 } -
trunk/Ohana/src/kapa2/src/CheckVisual.c
r13320 r13479 158 158 /* make private colormap */ 159 159 if (graphic[0].Npixels < 16) { 160 fprintf (stderr, "can't allocate enough cells, using private colormap\n");160 // fprintf (stderr, "can't allocate enough cells, using private colormap\n"); 161 161 graphic[0].colormap = XCreateColormap (graphic[0].display, RootWindow (graphic[0].display, graphic[0].screen), graphic[0].visual, AllocNone); 162 162 for (graphic[0].Npixels = NPIXELS; … … 178 178 if (!dyn) { 179 179 graphic[0].Npixels = 256; 180 fprintf (stderr, "can't use dynamic colors, color scrollbar inactive\n");181 fprintf (stderr, " this can be avoided by using a dynamic visual class\n");182 fprintf (stderr, " (see Kii help page for details)\n");180 // fprintf (stderr, "can't use dynamic colors, color scrollbar inactive\n"); 181 // fprintf (stderr, " this can be avoided by using a dynamic visual class\n"); 182 // fprintf (stderr, " (see Kii help page for details)\n"); 183 183 } 184 184 -
trunk/Ohana/src/kapa2/src/CreatePicture.c
r13320 r13479 56 56 case 32: 57 57 REALLOCATE (image[0].picture.data, char, (4*image[0].picture.dx*image[0].picture.dy + 32)); 58 fprintf (stderr, "allocating %d for picture data\n", (4*image[0].picture.dx*image[0].picture.dy + 32));59 58 memset (image[0].picture.data, 0xbd, 4*image[0].picture.dx*image[0].picture.dy + 30); 60 59 l = (unsigned int *) image[0].picture.data; -
trunk/Ohana/src/kapa2/src/CreateZoom16.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define XPIX(x,Rx,S) (x*S + Rx)3 # define ZPIX(value,Rz1,Rz2) (value*Rz1 - Rz2)4 2 # define FRAC(a) ((a) - (int)(a)) 3 4 static float slope = 1.0; 5 static float start = 0.0; 6 static int MaxValue = 255; 7 8 // XXX inline this if needed 9 static int PixelLookup(float value) { 10 int out; 11 out = MIN (MAX (slope * value - start, 0), MaxValue); 12 return (out); 13 } 5 14 6 15 void CreateZoom16 (KapaImageWidget *image, Graphic *graphic, double x, double y) { … … 9 18 int i_start, i_end, j_start, j_end; 10 19 int dropback; /* this is a bit of a kludge... */ 11 int dx, dy, DX, DY ;20 int dx, dy, DX, DY, pixelN; 12 21 double expand, zoomscale, Rx, Ry; 13 22 int expand_in, expand_out; 14 23 unsigned char *out_pix, *out_pix2, *data; 15 unsigned char*in_pix, *in_pix2;24 float *imdata, *in_pix, *in_pix2; 16 25 unsigned char pixel1[256], pixel2[256]; 17 26 unsigned char pixvalue1, pixvalue2; … … 37 46 back1 = 0x0000ff & back; 38 47 back2 = 0x0000ff & (back >> 8); 48 // define the color transform parameters 49 MaxValue = graphic[0].Npixels - 1; 50 if (image[0].range != 0.0) { 51 slope = graphic[0].Npixels / image[0].range; 52 start = graphic[0].Npixels * image[0].zero / image[0].range; 53 } else { 54 slope = 1.0; 55 start = image[0].zero; 56 } 39 57 40 58 zoomscale = MAX (5, image[0].expand + 5); … … 56 74 57 75 data = out_pix = (unsigned char *) image[0].zoom.data; 58 in_pix = (unsigned char *) (image[0].matrix.buffer) + DX*(int)MAX(Ry,0) + (int)MAX(Rx,0); 76 imdata = (float *) image[0].matrix.buffer; 77 in_pix = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)]; 59 78 60 79 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 91 110 if (expand_out == 1) { 92 111 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix+=2) { 93 out_pix[0] = pixel1[*in_pix2]; 94 out_pix[1] = pixel2[*in_pix2]; 112 pixelN = PixelLookup(*in_pix2); 113 out_pix[0] = pixel1[pixelN]; 114 out_pix[1] = pixel2[pixelN]; 95 115 } 96 } 97 else { 116 } else { 98 117 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= 2*expand_out) { 99 pixvalue1 = pixel1[*in_pix2]; 100 pixvalue2 = pixel2[*in_pix2]; 118 pixelN = PixelLookup(*in_pix2); 119 pixvalue1 = pixel1[pixelN]; 120 pixvalue2 = pixel2[pixelN]; 101 121 out_pix2 = out_pix; 102 122 for (jj = 0; jj < expand_out; jj++, out_pix2+=2*(dx-expand_out)) { … … 129 149 } 130 150 131 image[0].zoom.pix = XCreateImage (graphic[0].display, graphic[0].visual, 16, ZPixmap, 0,132 image[0].zoom.data, image[0].zoom.dx, image[0].zoom.dy, 32, 0);151 image[0].zoom.pix = XCreateImage (graphic[0].display, graphic[0].visual, graphic[0].depth, ZPixmap, 0, 152 image[0].zoom.data, image[0].zoom.dx, image[0].zoom.dy, 16, 0); 133 153 134 154 } -
trunk/Ohana/src/kapa2/src/CreateZoom24.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define XPIX(x,Rx,S) (x*S + Rx)3 # define ZPIX(value,Rz1,Rz2) (value*Rz1 - Rz2)4 2 # define FRAC(a) ((a) - (int)(a)) 3 4 static float slope = 1.0; 5 static float start = 0.0; 6 static int MaxValue = 255; 7 8 // XXX inline this if needed 9 static int PixelLookup(float value) { 10 int out; 11 out = MIN (MAX (slope * value - start, 0), MaxValue); 12 return (out); 13 } 5 14 6 15 void CreateZoom24 (KapaImageWidget *image, Graphic *graphic, double x, double y) { … … 9 18 int i_start, i_end, j_start, j_end; 10 19 int dropback; /* this is a bit of a kludge... */ 11 int dx, dy, DX, DY ;20 int dx, dy, DX, DY, pixelN; 12 21 double expand, zoomscale, Rx, Ry; 13 22 int expand_in, expand_out; 14 23 unsigned char *out_pix, *out_pix2, *data; 15 unsigned char *in_pix,*in_pix2;24 float *imdata, *in_pix, *in_pix2; 16 25 unsigned char pixel1[256], pixel2[256], pixel3[256]; 17 26 unsigned char pixvalue1, pixvalue2, pixvalue3; … … 41 50 back3 = 0x0000ff & (back >> 16); 42 51 52 // define the color transform parameters 53 MaxValue = graphic[0].Npixels - 1; 54 if (image[0].range != 0.0) { 55 slope = graphic[0].Npixels / image[0].range; 56 start = graphic[0].Npixels * image[0].zero / image[0].range; 57 } else { 58 slope = 1.0; 59 start = image[0].zero; 60 } 61 43 62 zoomscale = MAX (5, image[0].expand + 5); 44 63 expand = 1 / zoomscale; … … 59 78 60 79 data = out_pix = (unsigned char *) image[0].zoom.data; 61 in_pix = (unsigned char *) (image[0].matrix.buffer) + DX*(int)MAX(Ry,0) + (int)MAX(Rx,0); 80 imdata = (float *) image[0].matrix.buffer; 81 in_pix = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)]; 62 82 63 83 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 97 117 if (expand_out == 1) { 98 118 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix+=3) { 99 out_pix[0] = pixel1[*in_pix2]; 100 out_pix[1] = pixel2[*in_pix2]; 101 out_pix[2] = pixel3[*in_pix2]; 119 pixelN = PixelLookup(*in_pix2); 120 out_pix[0] = pixel1[pixelN]; 121 out_pix[1] = pixel2[pixelN]; 122 out_pix[2] = pixel3[pixelN]; 102 123 } 103 } 104 else { 124 } else { 105 125 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= 3*expand_out) { 106 pixvalue1 = pixel1[*in_pix2]; 107 pixvalue2 = pixel2[*in_pix2]; 108 pixvalue3 = pixel3[*in_pix2]; 126 pixelN = PixelLookup(*in_pix2); 127 pixvalue1 = pixel1[pixelN]; 128 pixvalue2 = pixel2[pixelN]; 129 pixvalue3 = pixel3[pixelN]; 109 130 out_pix2 = out_pix; 110 131 for (jj = 0; jj < expand_out; jj++, out_pix2+=3*(dx-expand_out)+extra) { -
trunk/Ohana/src/kapa2/src/CreateZoom32.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define XPIX(x,Rx,S) (x*S + Rx)3 # define ZPIX(value,Rz1,Rz2) (value*Rz1 - Rz2)4 2 # define FRAC(a) ((a) - (int)(a)) 3 4 static float slope = 1.0; 5 static float start = 0.0; 6 static int MaxValue = 255; 7 8 // XXX inline this if needed 9 static int PixelLookup(float value) { 10 int out; 11 out = MIN (MAX (slope * value - start, 0), MaxValue); 12 return (out); 13 } 5 14 6 15 void CreateZoom32 (KapaImageWidget *image, Graphic *graphic, double x, double y) { … … 9 18 int i_start, i_end, j_start, j_end; 10 19 int dropback; /* this is a bit of a kludge... */ 11 int dx, dy, DX, DY ;20 int dx, dy, DX, DY, pixelN; 12 21 double expand, zoomscale, Rx, Ry; 13 22 int expand_in, expand_out; 14 unsigned int *out_pix, *out_pix2 , *data;15 unsigned char *in_pix,*in_pix2;23 unsigned int *out_pix, *out_pix2; 24 float *imdata, *in_pix, *in_pix2; 16 25 unsigned long pixel[256], pixvalue; 17 26 unsigned long back; … … 28 37 } 29 38 back = graphic[0].back; 39 40 // define the color transform parameters 41 MaxValue = graphic[0].Npixels - 1; 42 if (image[0].range != 0.0) { 43 slope = graphic[0].Npixels / image[0].range; 44 start = graphic[0].Npixels * image[0].zero / image[0].range; 45 } else { 46 slope = 1.0; 47 start = image[0].zero; 48 } 30 49 31 50 zoomscale = MAX (5, image[0].expand + 5); … … 49 68 50 69 out_pix = (unsigned int *) image[0].zoom.data; 51 data = (unsigned int *) image[0].zoom.data;52 in_pix = (unsigned char *) (image[0].matrix.buffer) + DX*(int)MAX(Ry,0) + (int)MAX(Rx,0);70 imdata = (float *) image[0].matrix.buffer; 71 in_pix = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)]; 53 72 54 73 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 81 100 if (expand_out == 1) { 82 101 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix++) { 83 out_pix[0] = pixel[*in_pix2]; 102 pixelN = PixelLookup(*in_pix2); 103 out_pix[0] = pixel[pixelN]; 84 104 } 85 105 } 86 106 else { 87 107 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= expand_out) { 88 pixvalue = *(pixel + *in_pix2); 108 pixelN = PixelLookup(*in_pix2); 109 pixvalue = pixel[pixelN]; 89 110 out_pix2 = out_pix; 90 111 for (jj = 0; jj < expand_out; jj++, out_pix2+=(dx-expand_out)) { -
trunk/Ohana/src/kapa2/src/CreateZoom8.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define XPIX(x,Rx,S) (x*S + Rx)3 # define ZPIX(value,Rz1,Rz2) (value*Rz1 - Rz2)4 2 # define FRAC(a) ((a) - (int)(a)) 3 4 static float slope = 1.0; 5 static float start = 0.0; 6 static int MaxValue = 255; 7 8 // XXX inline this if needed 9 static int PixelLookup(float value) { 10 int out; 11 out = MIN (MAX (slope * value - start, 0), MaxValue); 12 return (out); 13 } 5 14 6 15 void CreateZoom8 (KapaImageWidget *image, Graphic *graphic, double x, double y) { … … 9 18 int i_start, i_end, j_start, j_end; 10 19 int dropback; /* this is a bit of a kludge... */ 11 int dx, dy, DX, DY ;20 int dx, dy, DX, DY, pixelN; 12 21 double expand, zoomscale, Rx, Ry; 13 22 int expand_in, expand_out; 14 char*out_pix, *out_pix2;15 char *in_pix,*in_pix2;23 unsigned char *out_pix, *out_pix2; 24 float *imdata, *in_pix, *in_pix2; 16 25 unsigned long pixel[256], pixvalue; 17 26 unsigned long back; … … 30 39 back = graphic[0].back; 31 40 41 // define the color transform parameters 42 MaxValue = graphic[0].Npixels - 1; 43 if (image[0].range != 0.0) { 44 slope = graphic[0].Npixels / image[0].range; 45 start = graphic[0].Npixels * image[0].zero / image[0].range; 46 } else { 47 slope = 1.0; 48 start = image[0].zero; 49 } 50 32 51 zoomscale = MAX (5, image[0].expand + 5); 33 52 expand = 1 / zoomscale; 34 53 expand_out = (int) zoomscale; 35 54 expand_in = 1; 36 37 /*38 dx = image[0].zoom.dx;39 dy = image[0].zoom.dy;40 DX = image[0].matrix.Naxis[0];41 DY = image[0].matrix.Naxis[1];42 Rx = 0.5*(DX - (dx - 1)*expand) - x;43 Ry = 0.5*(DY - (dy - 1)*expand) - y;44 data coords of 0,0 point in pic array45 X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].zoom.dx + 0.5) - 0.0) - image[0].X;46 Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].zoom.dy + 0.5) - 0.0) - image[0].Y;47 i_start = MIN (MAX (-Rx / expand, 0), dx - expand_out + 1);48 j_start = MIN (MAX (-Ry / expand, 0), dy - expand_out + 1);49 i_end = MAX (MIN ((DX-Rx) / expand, dx - expand_out + 1), 0);50 j_end = MAX (MIN ((DY-Ry) / expand, dy - expand_out + 1), 0);51 dropback = expand_out - (i_end - i_start) % expand_out;52 if ((i_end - i_start) % expand_out == 0) dropback = 0;53 54 out_pix = image[0].zoom.data;55 in_pix = (char *) (image[0].matrix.buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0);56 57 */58 55 59 56 dx = image[0].zoom.dx; … … 72 69 73 70 out_pix = (char *) image[0].zoom.data; 74 in_pix = (char *) (image[0].matrix.buffer) + DX*(int)MAX(Ry,0) + (int)MAX(Rx,0); 71 imdata = (float *) image[0].matrix.buffer; 72 in_pix = &imdata[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)]; 75 73 76 74 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 100 98 in_pix2 = in_pix; 101 99 if (expand_out == 1) { 102 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix++) 103 *out_pix = *(pixel + *in_pix2); 104 } 105 else { 100 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix++) { 101 pixelN = PixelLookup(*in_pix2); 102 *out_pix = pixel[pixelN]; 103 } 104 } else { 106 105 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= expand_out) { 107 pixvalue = *(pixel + *in_pix2); 106 pixelN = PixelLookup(*in_pix2); 107 pixvalue = pixel[pixelN]; 108 108 out_pix2 = out_pix; 109 109 for (jj = 0; jj < expand_out; jj++, out_pix2+=(dx-expand_out)) { … … 131 131 132 132 /**** fill in top area ****/ 133 for (j = 0; (j < dx*(dy - j_end)) && (out_pix - image[0].zoom.data < dx*dy); j++, out_pix++) {133 for (j = 0; (j < dx*(dy - j_end)) && (out_pix - (unsigned char *) image[0].zoom.data < dx*dy); j++, out_pix++) { 134 134 *out_pix = back; 135 135 } -
trunk/Ohana/src/kapa2/src/DefineSection.c
r13320 r13479 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 { … … 33 33 34 34 if (MoveSection) { 35 Set GraphSize(section);35 SetSectionSizes (section); 36 36 Refresh (1); 37 37 } -
trunk/Ohana/src/kapa2/src/EraseCurrentPlot.c
r13320 r13479 11 11 section = GetActiveSection(); 12 12 if (section->graph == NULL) return (TRUE); 13 13 14 EraseGraph (section->graph); 14 15 -
trunk/Ohana/src/kapa2/src/EraseOverlay.c
r13331 r13479 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); 16 17 17 18 if (N > NOVERLAYS) { 18 REALLOCATE (image[0].tickmarks.objects, Object, 1);19 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, 1); 19 20 image[0].tickmarks.Nobjects = 0; 20 21 } else { 21 22 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 22 if ( !strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {23 if (image[0].overlay[N].objects[i].type == KII_OVERLAY_TEXT) { 23 24 free (image[0].overlay[N].objects[i].text); 24 25 } 25 26 } 26 REALLOCATE (image[0].overlay[N].objects, Object, 1);27 REALLOCATE (image[0].overlay[N].objects, KiiOverlay, 1); 27 28 image[0].overlay[N].Nobjects = 0; 28 29 image[0].overlay[N].active = FALSE; -
trunk/Ohana/src/kapa2/src/GetPixelCount.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int GetPixelCount ( ) {3 int GetPixelCount (int sock) { 4 4 5 5 int i; -
trunk/Ohana/src/kapa2/src/Graphs.c
r13320 r13479 20 20 strcpy (graph[0].label[i].text, ""); 21 21 } 22 23 graph[0].data.xmin = 0.0; 24 graph[0].data.xmax = 1.0; 25 graph[0].data.ymin = 0.0; 26 graph[0].data.ymax = 1.0; 22 27 23 28 graph[0].Nobjects = 0; … … 100 105 FREE (graph[0].objects); 101 106 FREE (graph[0].textline); 107 free (graph); 102 108 return; 103 109 } -
trunk/Ohana/src/kapa2/src/Image.c
r13331 r13479 21 21 image[0].start = 0; 22 22 image[0].slope = 1; 23 image[0].location = 4; 23 24 24 25 image[0].coords.Npolyterms = 0; 25 26 for (i = 0; i < NOVERLAYS; i++) { 26 27 image[0].overlay[i].Nobjects = 0; 27 ALLOCATE (image[0].overlay[i].objects, Object, 1); /* allocate so later free will not crash! */28 ALLOCATE (image[0].overlay[i].objects, KiiOverlay, 1); /* allocate so later free will not crash! */ 28 29 image[0].overlay[i].active = FALSE; 29 30 image[0].overlay[i].color = graphic[0].overlay_color[i]; … … 96 97 graphic = GetGraphic (); 97 98 98 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);99 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc,100 image[0].picture.x, image[0].picture.y,101 image[0].picture.dx + 1, image[0].picture.dy +1);99 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 100 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, 101 image[0].picture.x, image[0].picture.y, 102 image[0].picture.dx+1, image[0].picture.dy+1); 102 103 103 104 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, … … 106 107 image[0].picture.dx, image[0].picture.dy); 107 108 108 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc,109 image[0].cmapbar.pix, 0, 0,110 image[0].cmapbar.x, image[0].cmapbar.y,111 image[0].cmapbar.dx, image[0].cmapbar.dy);112 113 CrossHairs (graphic, image);114 115 109 for (i = 0; i < NOVERLAYS; i++) { 116 110 if (image[0].overlay[i].active) { … … 118 112 } 119 113 } 120 # if (0)121 PaintTickmarks (graphic, image);122 # endif123 114 124 // XXX make this optional?a 125 if (1) { 115 if (image[0].location) { 116 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 117 image[0].cmapbar.pix, 0, 0, 118 image[0].cmapbar.x, image[0].cmapbar.y, 119 image[0].cmapbar.dx, image[0].cmapbar.dy); 120 121 CrossHairs (graphic, image); 122 126 123 /* erase everything below zoom box, then draw */ 124 /* 127 125 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 128 126 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, 129 image[0].text_x, image[0].text_x, image[0]. zoom.dx, graphic[0].dy);130 127 image[0].text_x, image[0].text_x, image[0].text_dx, image[0].text_dy); 128 */ 131 129 DrawButton (graphic, &image[0].PS_button); 132 130 DrawButton (graphic, &image[0].recenter_button); … … 139 137 DrawButton (graphic, &image[0].overlay_button[i]); 140 138 } 139 StatusBox (graphic, image); 141 140 } 142 143 StatusBox (graphic, image);144 141 145 142 FlushDisplay (graphic[0].display); 146 143 } 144 145 void FreeImage (KapaImageWidget *image) { 146 147 int i; 148 149 if (image == NULL) return; 150 151 for (i = 0; i < NOVERLAYS; i++) { 152 free (image[0].overlay[i].objects); 153 } 154 free (image[0].matrix.buffer); 155 free (image[0].picture.data); 156 free (image[0].cmapbar.data); 157 free (image[0].zoom.data); 158 159 free (image); 160 } -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r13333 r13479 3 3 int InterpretKeys (Graphic *graphic, XKeyEvent *event) { 4 4 5 double X, Y, offset; 6 int modstate; 5 float *imdata; 6 double X, Y, Z, R, D, offset; 7 int sock, DX, DY, modstate; 7 8 char *name, string[16], line[40]; 8 9 KeySym keysym; … … 23 24 // XXX allow user to choose graph or image coords 24 25 if (ACTIVE_CURSOR) { 26 27 sock = GetActiveSocket (); 28 if (sock == -1) goto skip_cursor; 29 25 30 name = XKeysymToString (keysym); 26 31 … … 43 48 if (!strcmp (name, "(null)")) goto skip_cursor; 44 49 50 Z = -1; 51 45 52 if (graph) { 46 53 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 47 54 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 55 XY_to_RD (&R, &D, X, Y, &graph[0].data.coords); 48 56 } 49 57 if (image && !graph) { … … 53 61 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 54 62 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 63 XY_to_RD (&R, &D, X, Y, &image[0].coords); 64 65 DX = image[0].matrix.Naxis[0]; 66 DY = image[0].matrix.Naxis[1]; 67 68 if (X < 0) goto off_image; 69 if (Y < 0) goto off_image; 70 if (X >= DX) goto off_image; 71 if (Y >= DY) goto off_image; 72 imdata = (float *) image[0].matrix.buffer; 73 Z = imdata[DX*(int)(Y) + (int)(X)]; 55 74 } 56 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y);57 write (sock, line, 40);75 off_image: 76 KiiSendMessage (sock, "%12s %12.6f %12.6f %12.6f %12.6f %12.6f", name, X, Y, Z, R, D); 58 77 } 59 78 60 79 skip_cursor: 80 if (image == NULL) return (TRUE); 81 61 82 // offset is in image pixels: 62 83 // 0.5 image pixels is 1 screen pixel for expand == +2 -
trunk/Ohana/src/kapa2/src/InterpretPresses.c
r13333 r13479 3 3 int InterpretPresses (Graphic *graphic, XButtonEvent *event) { 4 4 5 int s tatus, done, this_button, old_cursor;5 int sock, DX, DY, status, done, this_button, old_cursor; 6 6 char name[16], line[40]; 7 double X, Y; 7 double X, Y, Z, R, D; 8 float *imdata; 8 9 KeySym keysym; 9 10 Button *button; … … 20 21 // XXX allow user to choose graph or image coords 21 22 if (ACTIVE_CURSOR) { 23 sock = GetActiveSocket (); 24 if (sock == -1) goto skip_cursor; 25 22 26 sprintf (name, "Button%d", event[0].button); 23 27 if (graph) { 24 28 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 25 29 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 30 XY_to_RD (&R, &D, X, Y, &graph[0].data.coords); 26 31 } 27 32 if (image && !graph) { … … 30 35 if (event[0].x > image[0].picture.x + image[0].picture.dx) goto skip_cursor; 31 36 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 32 33 37 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 38 39 XY_to_RD (&R, &D, X, Y, &image[0].coords); 40 41 DX = image[0].matrix.Naxis[0]; 42 DY = image[0].matrix.Naxis[1]; 43 44 if (X < 0) goto off_image; 45 if (Y < 0) goto off_image; 46 if (X >= DX) goto off_image; 47 if (Y >= DY) goto off_image; 48 imdata = (float *) image[0].matrix.buffer; 49 Z = imdata[DX*(int)(Y) + (int)(X)]; 34 50 } 35 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y);36 write (sock, line, 40);51 off_image: 52 KiiSendMessage (sock, "%12s %12.6f %12.6f %12.6f %12.6f %12.6f", name, X, Y, Z, R, D); 37 53 } 38 54 … … 40 56 status = TRUE; 41 57 this_button = event[0].button; 58 59 // XXX add graph buttons here 60 if (image == NULL) return (TRUE); 42 61 43 62 if ((event[0].type == ButtonPress) && InPicture (event, &image[0].picture)) { -
trunk/Ohana/src/kapa2/src/JPEGit24.c
r13320 r13479 6 6 # define WHITE_B 255 7 7 8 // XXX this currently writes out the jpeg for the active image 9 int JPEGit24 () { 8 static float slope = 1.0; 9 static float start = 0.0; 10 static int MaxValue = 255; 11 12 // XXX inline this if needed 13 static int PixelLookup(float value) { 14 int out; 15 out = MIN (MAX (slope * value - start, 0), MaxValue); 16 return (out); 17 } 18 19 // XXX this currently writes out the jpeg for just the active image 20 int JPEGit24 (int sock) { 10 21 11 22 struct jpeg_compress_struct cinfo; … … 21 32 int i_start, i_end, j_start, j_end; 22 33 int dropback; /* this is a bit of a kludge... */ 23 int dx, dy, DX, DY ;34 int dx, dy, DX, DY, pixelN; 24 35 int status, Nbytes, quality; 25 36 int expand_in, expand_out; 26 37 double expand, Rx, Ry, X, Y; 27 unsigned char *out_pix, *in_pix, *in_pix_ref; 38 unsigned char *out_pix; 39 float *imdata, *in_pix, *in_pix_ref; 28 40 unsigned char pixel1[256], pixel2[256], pixel3[256]; 29 41 char filename[1024]; 30 42 FILE *f; 31 43 44 /* expect a line telling the number of bytes and a filename */ 45 KiiScanMessage (sock, "%s", filename); 46 32 47 graphic = GetGraphic(); 33 48 section = GetActiveSection(); 34 49 image = section->image; 35 36 /* expect a line telling the number of bytes and a filename */ 37 KiiScanMessage (sock, "%s", filename); 50 if (image == NULL) return (TRUE); 38 51 39 52 /***** JPEG init calls */ … … 69 82 } 70 83 84 // define the color transform parameters 85 MaxValue = graphic[0].Npixels - 1; 86 if (image[0].range != 0.0) { 87 slope = graphic[0].Npixels / image[0].range; 88 start = graphic[0].Npixels * image[0].zero / image[0].range; 89 } else { 90 slope = 1.0; 91 start = image[0].zero; 92 } 93 71 94 expand = expand_in = expand_out = 1.0; 72 95 if (image[0].expand == 0) /* set up expansions */ … … 122 145 ALLOCATE (line_buffer, JSAMPLE, 3*dx); 123 146 124 in_pix_ref = (unsigned char *) (image[0].matrix.buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0); 147 imdata = (float *) image[0].matrix.buffer; 148 in_pix_ref = &imdata[DX*(int)MAX(Y,0) + (int)MAX(X,0)]; 125 149 126 150 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 153 177 /*** fill in the picture region ***/ 154 178 for (i = i_start; i < i_end; i+=expand_out, in_pix+=expand_in) { 179 pixelN = PixelLookup(*in_pix); 155 180 for (ii = 0; ii < expand_out; ii++, out_pix+=3) { 156 out_pix[0] = pixel1[ *in_pix];157 out_pix[1] = pixel2[ *in_pix];158 out_pix[2] = pixel3[ *in_pix];181 out_pix[0] = pixel1[pixelN]; 182 out_pix[1] = pixel2[pixelN]; 183 out_pix[2] = pixel3[pixelN]; 159 184 } 160 185 } -
trunk/Ohana/src/kapa2/src/Layout.c
r13333 r13479 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 } -
trunk/Ohana/src/kapa2/src/LoadFrame.c
r13320 r13479 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 SetSectionSizes (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, … … 60 62 } 61 63 64 SetSectionSizes (section); 62 65 if (USE_XWINDOW) DrawFrame (graph); 63 66 FlushDisplay (); -
trunk/Ohana/src/kapa2/src/LoadLabels.c
r13320 r13479 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 SetSectionSizes (section); 14 } 11 15 graph = section->graph; 12 13 fcntl (sock, F_SETFL, !O_NONBLOCK);14 16 15 17 KiiScanMessage (sock, "%d", &mode); … … 21 23 strncpy (graph[0].label[mode].text, label, Nbytes); 22 24 label[Nbytes] = 0; 23 24 fcntl (sock, F_SETFL, O_NONBLOCK);25 25 26 26 c = GetRotFont (&size); -
trunk/Ohana/src/kapa2/src/LoadObject.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 # include <errno.h> 3 4 int LoadObject () { 3 # define DEBUG 0 4 5 int LoadObject (int sock) { 5 6 6 7 int N; … … 9 10 10 11 section = GetActiveSection(); 12 if (section->graph == NULL) { 13 section->graph = InitGraph (); 14 SetSectionSizes (section); 15 } 11 16 graph = section->graph; 12 13 fcntl (sock, F_SETFL, !O_NONBLOCK);14 17 15 18 N = graph[0].Nobjects; … … 41 44 &graph[0].objects[N].x0, &graph[0].objects[N].x1, 42 45 &graph[0].objects[N].y0, &graph[0].objects[N].y1); 43 44 fcntl (sock, F_SETFL, O_NONBLOCK); 45 46 if (!LoadVectorData (graph, N, "x")) { 46 47 // acknowledge receipt of the metadata 48 KiiSendCommand (sock, 4, "DONE"); 49 50 // XXX Currently, I require these in a special order. The data includes a message defining the 51 // object type. This could be made more flexible by using the information (though we still need 52 // to know how many items will be sent) 53 54 if (!LoadVectorData (sock, graph, N, "x")) { 47 55 FreeObjectData (&graph[0].objects[N]); 48 56 graph[0].Nobjects --; … … 50 58 } 51 59 52 if (!LoadVectorData ( graph, N, "y")) {60 if (!LoadVectorData (sock, graph, N, "y")) { 53 61 FreeObjectData (&graph[0].objects[N]); 54 62 graph[0].Nobjects --; … … 56 64 } 57 65 if (graph[0].objects[N].size < 0.0) { 58 if (!LoadVectorData ( graph, N, "z")) {66 if (!LoadVectorData (sock, graph, N, "z")) { 59 67 FreeObjectData (&graph[0].objects[N]); 60 68 graph[0].Nobjects --; … … 63 71 } 64 72 if (graph[0].objects[N].etype & 0x01) { 65 if (!LoadVectorData ( graph, N, "dym")) {66 FreeObjectData (&graph[0].objects[N]); 67 graph[0].Nobjects --; 68 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 69 } 70 if (!LoadVectorData ( graph, N, "dyp")) {73 if (!LoadVectorData (sock, graph, N, "dym")) { 74 FreeObjectData (&graph[0].objects[N]); 75 graph[0].Nobjects --; 76 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 77 } 78 if (!LoadVectorData (sock, graph, N, "dyp")) { 71 79 FreeObjectData (&graph[0].objects[N]); 72 80 graph[0].Nobjects --; … … 75 83 } 76 84 if (graph[0].objects[N].etype & 0x02) { 77 if (!LoadVectorData ( graph, N, "dxm")) {78 FreeObjectData (&graph[0].objects[N]); 79 graph[0].Nobjects --; 80 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 81 } 82 if (!LoadVectorData ( graph, N, "dxp")) {85 if (!LoadVectorData (sock, graph, N, "dxm")) { 86 FreeObjectData (&graph[0].objects[N]); 87 graph[0].Nobjects --; 88 REALLOCATE (graph[0].objects, Gobjects, MAX (1, graph[0].Nobjects)); 89 } 90 if (!LoadVectorData (sock, graph, N, "dxp")) { 83 91 FreeObjectData (&graph[0].objects[N]); 84 92 graph[0].Nobjects --; … … 96 104 } 97 105 98 /* load data for the named component */ 99 int LoadVectorData (KapaGraphWidget *graph, int N, char *type) { 100 101 int Npts, Ninpts, status, Ntry; 106 int LoadVectorData (int sock, KapaGraphWidget *graph, int N, char *type) { 107 108 int i, Npts, Ninpts, status, Ntry; 102 109 int bytes_left; 103 char *buff; 104 105 buff = NULL; 110 char *byte, *buffer, type_send[16], tmp; 111 int Npts_send, Nbytes_send, swap_client, swap_host; 112 113 buffer = NULL; 106 114 Npts = graph[0].objects[N].Npts; 115 116 KiiWaitAnswer (sock, "PLOB"); 117 KiiScanMessage (sock, "%s %d %d %d", type_send, &Npts_send, &Nbytes_send, &swap_client); 118 if (strcmp (type, type_send)) { 119 fprintf (stderr, "Kapa Communication error: unexpected data type %s vs %s\n", type_send, type); 120 } 121 if (Npts_send != Npts) { 122 fprintf (stderr, "Kapa Communication error: unexpected number of points %d vs %d\n", Npts_send, Npts); 123 } 124 if (Nbytes_send != Npts_send*sizeof(float)) { 125 fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %d\n", Nbytes_send, Npts_send*sizeof(float)); 126 } 127 107 128 status = 1; 108 129 if (!strcmp (type, "x")) { 109 130 ALLOCATE (graph[0].objects[N].x, float, MAX (1, Npts)); 110 buff = (char *) graph[0].objects[N].x;131 buffer = (char *) graph[0].objects[N].x; 111 132 } 112 133 if (!strcmp (type, "y")) { 113 134 ALLOCATE (graph[0].objects[N].y, float, MAX (1, Npts)); 114 buff = (char *) graph[0].objects[N].y;135 buffer = (char *) graph[0].objects[N].y; 115 136 } 116 137 if (!strcmp (type, "z")) { 117 138 ALLOCATE (graph[0].objects[N].z, float, MAX (1, Npts)); 118 buff = (char *) graph[0].objects[N].z;139 buffer = (char *) graph[0].objects[N].z; 119 140 } 120 141 if (!strcmp (type, "dxm")) { 121 142 ALLOCATE (graph[0].objects[N].dxm, float, MAX (1, Npts)); 122 buff = (char *) graph[0].objects[N].dxm;143 buffer = (char *) graph[0].objects[N].dxm; 123 144 } 124 145 if (!strcmp (type, "dxp")) { 125 146 ALLOCATE (graph[0].objects[N].dxp, float, MAX (1, Npts)); 126 buff = (char *) graph[0].objects[N].dxp;147 buffer = (char *) graph[0].objects[N].dxp; 127 148 } 128 149 if (!strcmp (type, "dym")) { 129 150 ALLOCATE (graph[0].objects[N].dym, float, MAX (1, Npts)); 130 buff = (char *) graph[0].objects[N].dym;151 buffer = (char *) graph[0].objects[N].dym; 131 152 } 132 153 if (!strcmp (type, "dyp")) { 133 154 ALLOCATE (graph[0].objects[N].dyp, float, MAX (1, Npts)); 134 buff = (char *) graph[0].objects[N].dyp;155 buffer = (char *) graph[0].objects[N].dyp; 135 156 } 136 157 137 158 bytes_left = Npts*sizeof (float); 138 159 160 fcntl (sock, F_SETFL, O_NONBLOCK); 161 162 // read the vector data as raw binary in client machine byte order (floats) 139 163 Ntry = 0; 140 164 if (DEBUG) fprintf (stderr, "starting vector load\n"); 141 165 Ninpts = 0; 166 byte = buffer; 142 167 while (bytes_left > 0) { 143 status = read (sock, b uff, bytes_left);168 status = read (sock, byte, bytes_left); 144 169 if (DEBUG) fprintf (stderr, "status: %d, %d\n", status, bytes_left); 145 170 if (status == 0) { /* No more pipe */ … … 150 175 Ninpts += status; 151 176 bytes_left -= status; 152 b uff = (char *)(buff+ status);177 byte = (char *)(byte + status); 153 178 Ntry = 0; 154 179 continue; … … 165 190 perror ("kapa load"); 166 191 } 192 193 fcntl (sock, F_SETFL, !O_NONBLOCK); 194 KiiSendCommand (sock, 4, "DONE"); 195 196 # ifdef BYTE_SWAP 197 swap_host = 1; 198 # else 199 swap_host = 0; 200 # endif 201 202 // if host and client have opposite swap parities, word swap the incoming data 203 // SWAP_WORD is strangely defined... it takes the number of the start byte in a 204 // buffer called 'byte' 205 if ((swap_host && !swap_client) || (!swap_host && swap_client)) { 206 byte = buffer; 207 for (i = 0; i < Nbytes_send; i+=4) { 208 SWAP_WORD (i); 209 } 210 } 211 167 212 if (Ninpts != Npts*sizeof(float)) { 168 213 fprintf (stderr, "error: expected %d bytes, but got only %d\n", Ninpts, (unsigned int)(Npts*sizeof(float))); … … 185 230 if (object[0].dyp != (float *) NULL) free (object[0].dyp); 186 231 } 187 -
trunk/Ohana/src/kapa2/src/LoadOverlay.c
r13331 r13479 1 1 # include "Ximage.h" 2 2 3 // XXX this is a very inefficient method to send the data: binary would be better 4 int LoadOverlay () { 3 int LoadOverlay (int sock) { 5 4 6 char word[17], type[16], string[128]; 7 char *buffer, *buff; 8 double x, y, dx, dy; 9 int Nin, bytes, status; 10 int i, N, NOBJECTS, Nobjects, Nstart; 5 int i, j, Ntotal, Nbytes, Nread, Nfound, Ntext, Nobjects, overnum; 6 int Noverlay, NOVERLAY, Ntextdata; 7 char *textdata, *buffer, *p, *q; 11 8 Section *section; 12 9 KapaImageWidget *image; 13 10 Graphic *graphic; 11 KiiOverlayBase *overlay; 14 12 15 13 graphic = GetGraphic (); 16 14 section = GetActiveSection(); 17 image = section->image; 15 if (section->image == NULL) { 16 section->image = InitImage (); 17 SetSectionSizes (section); 18 } 19 image = section->image; 18 20 19 ALLOCATE (buffer, char, 65536); /* space for 512 lines of 128 bytes */ 20 bzero (buffer, 65536); 21 KiiScanMessage (sock, "%d %d %d %d", &overnum, &Noverlay, &Ntext, &Ntextdata); 21 22 22 KiiScanCommand (sock, 16, "%*s %d", &N);23 Nstart = image[0].overlay[N].Nobjects;23 // XXX need to validate overnum 24 if ((overnum < 0) || (overnum >= NOVERLAYS)) overnum = 0; 24 25 25 while (1) { 26 KiiScanCommand (sock, 16, "%s %d", word, &Nin); 27 if (!strcmp (word, "DONE")) break; 28 if (strcmp (word, "NLINES")) abort(); 26 // read the overlay data as binary 27 Ntotal = 0; 28 Nbytes = Noverlay*sizeof(KiiOverlayBase); 29 fcntl (sock, F_SETFL, O_NONBLOCK); 30 ALLOCATE (overlay, KiiOverlayBase, Noverlay); 31 buffer = (char *) overlay; 32 while (Nbytes > 0) { 33 Nread = read (sock, &buffer[Ntotal], Nbytes); 34 // fprintf (stderr, "read: %d of %d remaining, %d so far, %d expected\n", Nread, Nbytes, Ntotal, Noverlay*sizeof(KiiOverlayBase)); 35 if (Nread == 0) { /* No more pipe */ 36 fprintf (stderr, "error: pipe closed\n"); 37 free (overlay); 38 fcntl (sock, F_SETFL, !O_NONBLOCK); 39 return (FALSE); 40 } 41 if (Nread != -1) { /* pipe has data */ 42 Nbytes -= Nread; 43 Ntotal += Nread; 44 } 45 } 46 fcntl (sock, F_SETFL, !O_NONBLOCK); 47 KiiSendCommand (sock, 4, "DONE"); 29 48 30 buff = buffer; 31 bytes = 128*Nin; 49 // read the textdata as binary 50 Ntotal = 0; 51 Nbytes = Ntextdata; 52 fcntl (sock, F_SETFL, O_NONBLOCK); 53 ALLOCATE (textdata, char, Ntextdata); 54 while (Nbytes > 0) { 55 Nread = read (sock, &textdata[Ntotal], Nbytes); 56 if (Nread == 0) { /* No more pipe */ 57 fprintf (stderr, "error: pipe closed\n"); 58 free (textdata); 59 free (overlay); 60 fcntl (sock, F_SETFL, !O_NONBLOCK); 61 return (FALSE); 62 } 63 if (Nread != -1) { /* pipe has data */ 64 Nbytes -= Nread; 65 Ntotal += Nread; 66 } 67 } 68 fcntl (sock, F_SETFL, !O_NONBLOCK); 69 KiiSendCommand (sock, 4, "DONE"); 32 70 33 /* accept data from the socket until we have all of the bytes */ 34 fcntl (sock, F_SETFL, O_NONBLOCK); 35 while (bytes > 0) { 36 status = read (sock, buff, bytes); 37 if (status == 0) { /* No more pipe */ 38 fprintf (stderr, "error: pipe closed\n"); 39 free (buffer); 40 fcntl (sock, F_SETFL, O_NONBLOCK); 41 return (FALSE); 42 } 43 if (status != -1) { /* pipe has data */ 44 bytes -= status; 45 buff = (char *)(buff + status); 46 } 47 } 48 fcntl (sock, F_SETFL, !O_NONBLOCK); 71 // add new overlay objects to existing data 72 Nobjects = image[0].overlay[overnum].Nobjects + Noverlay; 73 REALLOCATE (image[0].overlay[overnum].objects, KiiOverlay, Nobjects); 49 74 50 /* parse buffer data */ 51 NOBJECTS = image[0].overlay[N].Nobjects + Nin; 52 Nobjects = image[0].overlay[N].Nobjects; 53 REALLOCATE (image[0].overlay[N].objects, Object, NOBJECTS); 54 for (i = 0; i < Nin; i++) { 55 sscanf (&buffer[i*128], "%s %lf %lf %lf %lf\n", type, &x, &y, &dx, &dy); 56 57 if (strcasecmp (type, "TEXT") && strcasecmp (type, "LINE") && strcasecmp (type, "BOX") && strcasecmp (type, "CIRCLE")) { /* skip */ 58 fprintf (stderr, "don't know %s, skipping\n", type); 59 continue; 60 } 61 62 if (!strcasecmp (type, "TEXT")) { /* end of objects */ 63 sscanf (&buffer[i*128], "%s %lf %lf %s\n", type, &x, &y, string); 64 } 65 66 strcpy (image[0].overlay[N].objects[Nobjects].type, type); 67 image[0].overlay[N].objects[Nobjects].x = x; 68 image[0].overlay[N].objects[Nobjects].y = y; 69 if (!strcmp (type, "TEXT")) { 70 image[0].overlay[N].objects[Nobjects].dx = 0; 71 image[0].overlay[N].objects[Nobjects].dy = 0; 72 image[0].overlay[N].objects[Nobjects].text = strcreate (string); 73 } else { 74 image[0].overlay[N].objects[Nobjects].dx = dx; 75 image[0].overlay[N].objects[Nobjects].dy = dy; 76 } 77 Nobjects++; 78 } 79 REALLOCATE (image[0].overlay[N].objects, Object, MAX(Nobjects, 1)); 80 image[0].overlay[N].Nobjects = Nobjects; 75 j = image[0].overlay[overnum].Nobjects; 76 for (i = 0; i < Noverlay; i++, j++) { 77 image[0].overlay[overnum].objects[j].x = overlay[i].x; 78 image[0].overlay[overnum].objects[j].y = overlay[i].y; 79 image[0].overlay[overnum].objects[j].dx = overlay[i].dx; 80 image[0].overlay[overnum].objects[j].dy = overlay[i].dy; 81 image[0].overlay[overnum].objects[j].type = overlay[i].type; 82 image[0].overlay[overnum].objects[j].text = NULL; 81 83 } 82 84 83 /* cleanup */ 84 free (buffer); 85 REALLOCATE (image[0].overlay[N].objects, Object, MAX (1, image[0].overlay[N].Nobjects)); 86 image[0].overlay[N].active = TRUE; 87 fcntl (sock, F_SETFL, O_NONBLOCK); 85 // parse the text data : text lines are separated by '\n', one per text entry 86 p = textdata; 87 Nfound = 0; 88 for (i = 0; i < Noverlay; i++) { 89 if (overlay[i].type != KII_OVERLAY_TEXT) continue; 90 if (Nfound >= Ntext) { 91 fprintf (stderr, "inconsistent number of text lines\n"); 92 break; 93 } 94 if (! *p) { 95 fprintf (stderr, "inconsistent number of text lines\n"); 96 break; 97 } 98 q = strchr (p, '\n'); 99 if (q == NULL) { 100 fprintf (stderr, "inconsistent text line\n"); 101 break; 102 } 103 j = image[0].overlay[overnum].Nobjects + i; 104 image[0].overlay[overnum].objects[j].text = strncreate (p, q-p); 105 p = q + 1; 106 Nfound ++; 107 } 108 if (Nfound != Ntext) { 109 fprintf (stderr, "read %d text lines, expected %d\n", Nfound, Ntext); 110 } 111 112 free (textdata); 113 free (overlay); 114 115 image[0].overlay[overnum].Nobjects = Nobjects; 116 image[0].overlay[overnum].active = TRUE; 88 117 89 118 if (USE_XWINDOW) { … … 93 122 } 94 123 } 95 PaintTickmarks (graphic, image);96 124 XFlush (graphic[0].display); 97 125 } -
trunk/Ohana/src/kapa2/src/LoadPicture.c
r13320 r13479 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 SetSectionSizes (section); 17 } 18 image = section->image; 15 19 16 20 KiiSendMessage (sock, "%d", graphic->Npixels); 17 21 18 fcntl (sock, F_SETFL, !O_NONBLOCK);19 20 22 header.Naxes = 2; 21 22 23 KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.Naxis[0], &header.Naxis[1]); 23 24 KiiScanMessage (sock, "%d %d %d %d %lf %lf", &header.bitpix, &header.unsign, &header.bzero, &header.bscale); 24 KiiScanMessage (sock, "%lf %lf ", &image[0].zero, &image[0].range);25 KiiScanMessage (sock, "%lf %lf %s", &image[0].zero, &image[0].range, image[0].name, image[0].file); 25 26 KiiScanMessage (sock, "%lf %lf %d", &image[0].min, &image[0].max, &header.size); 26 27 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval1, &image[0].coords.crpix1, &image[0].coords.cdelt1, &image[0].coords.pc1_1, &image[0].coords.pc1_2); 27 28 KiiScanMessage (sock, "%lf %f %f %f %f", &image[0].coords.crval2, &image[0].coords.crpix2, &image[0].coords.cdelt2, &image[0].coords.pc2_1, &image[0].coords.pc2_2); 28 29 KiiScanMessage (sock, "%s %s %s", image[0].coords.ctype, image[0].file, image[0].buffer_name); 29 KiiScanMessage (sock, "%s", image[0].coords.ctype); 30 30 31 31 gfits_free_matrix (&image[0].matrix); … … 51 51 } 52 52 53 fcntl (sock, F_SETFL, !O_NONBLOCK); 54 53 55 if (DEBUG) fprintf (stderr, "read %d bytes\n", image[0].matrix.size); 54 56 /* it it not obvious this condition should kill kii, but ... */ -
trunk/Ohana/src/kapa2/src/LoadTextlines.c
r13320 r13479 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 14 fcntl (sock, F_SETFL, !O_NONBLOCK); 15 13 if (section->graph == NULL) { 14 section->graph = InitGraph (); 15 SetSectionSizes (section); 16 } 17 16 18 graph[0].Ntextline = MAX (graph[0].Ntextline, 0); 17 19 N = graph[0].Ntextline; … … 34 36 strcpy (graph[0].textline[N].text, string); 35 37 free (string); 36 37 fcntl (sock, F_SETFL, O_NONBLOCK);38 38 39 39 string = GetRotFont (&size); -
trunk/Ohana/src/kapa2/src/LoadTickmarks.c
r13320 r13479 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 SetSectionSizes (section); 15 } 12 16 image = section->image; 13 fcntl (sock, F_SETFL, !O_NONBLOCK);14 17 15 18 Nobjects = image[0].tickmarks.Nobjects; 16 19 NOBJECTS = Nobjects + 100; 17 REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);20 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS); 18 21 19 22 done = FALSE; … … 51 54 if (Nobjects >= NOBJECTS) { 52 55 NOBJECTS = Nobjects + 100; 53 REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);56 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS); 54 57 } 55 58 56 59 } 57 60 58 REALLOCATE (image[0].tickmarks.objects, Object, MAX(Nobjects, 1));61 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, MAX(Nobjects, 1)); 59 62 image[0].tickmarks.Nobjects = Nobjects; 60 63 61 64 if (USE_XWINDOW) Refresh (); 62 63 fcntl (sock, F_SETFL, O_NONBLOCK);64 65 return (TRUE); 65 66 66 } -
trunk/Ohana/src/kapa2/src/PNGit.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int PNGit ( ) {3 int PNGit (int sock) { 4 4 5 5 FILE *f; -
trunk/Ohana/src/kapa2/src/PPMit.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int PPMit ( ) {3 int PPMit (int sock) { 4 4 5 5 FILE *f; -
trunk/Ohana/src/kapa2/src/PSOverlay.c
r13331 r13479 31 31 dY = (image[0].overlay[N].objects[i].dy)/expand; 32 32 33 if (!strcmp (image[0].overlay[N].objects[i].type, "LINE")) { 34 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 35 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 36 continue; 37 } 38 fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra)); 39 continue; 33 switch (image[0].overlay[N].objects[i].type) { 34 case KII_OVERLAY_LINE: 35 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 36 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 37 break; 38 } 39 fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra)); 40 break; 41 case KII_OVERLAY_TEXT: 42 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 43 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 44 break; 45 } 46 fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra); 47 break; 48 case KII_OVERLAY_BOX: 49 if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) || 50 ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) { 51 break; 52 } 53 fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra)); 54 break; 55 case KII_OVERLAY_CIRCLE: 56 if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) || 57 ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) { 58 break; 59 } 60 fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra)); 61 break; 62 default: 63 fprintf (stderr, "skipping unknown object\n"); 64 break; 40 65 } 41 if (!strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {42 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||43 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {44 continue;45 }46 fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra);47 continue;48 }49 if (!strcmp (image[0].overlay[N].objects[i].type, "BOX")) {50 if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) ||51 ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) {52 continue;53 }54 fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra));55 continue;56 }57 if (!strcmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {58 if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) ||59 ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) {60 continue;61 }62 fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra));63 continue;64 }65 fprintf (stderr, "don't know %s, skipping\n", image[0].overlay[N].objects[i].type);66 66 } 67 68 67 } -
trunk/Ohana/src/kapa2/src/PSit.c
r13331 r13479 6 6 static Graphic *graphic; 7 7 8 int PScommand ( ) {8 int PScommand (int sock) { 9 9 10 10 int status, scaleMode, pageMode; -
trunk/Ohana/src/kapa2/src/PaintOverlay.c
r13320 r13479 41 41 for a BOX (x, y) is the center, (dx, dy) is the width */ 42 42 43 if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) { 44 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 45 continue; 43 switch (image[0].overlay[N].objects[i].type) { 44 case KII_OVERLAY_LINE: 45 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 46 break; 47 case KII_OVERLAY_TEXT: 48 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text)); 49 break; 50 case KII_OVERLAY_BOX: 51 dx = MAX (abs(dX),2) / 2; 52 dy = MAX (abs(dY),2) / 2; 53 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy); 54 break; 55 case KII_OVERLAY_CIRCLE: 56 dx = MAX (abs(dX),2); 57 dy = MAX (abs(dY),2); 58 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040); 59 break; 60 default: 61 fprintf (stderr, "skipping unknown object\n"); 62 break; 46 63 } 47 if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {48 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text));49 continue;50 }51 if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {52 dx = MAX (abs(dX),2) / 2;53 dy = MAX (abs(dY),2) / 2;54 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy);55 continue;56 }57 if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {58 dx = MAX (abs(dX),2);59 dy = MAX (abs(dY),2);60 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040);61 continue;62 }63 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);64 64 } 65 65 -
trunk/Ohana/src/kapa2/src/PaintTickmarks.c
r13320 r13479 22 22 dY = image[0].tickmarks.objects[i].dy * Yrange; 23 23 24 if (!strcmp (image[0].tickmarks.objects[i].type, "LINE")) { 25 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 26 continue; 24 switch (image[0].overlay[0].objects[i].type) { 25 case KII_OVERLAY_LINE: 26 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 27 break; 28 case KII_OVERLAY_TEXT: 29 if (image[0].tickmarks.objects[i].dy == 0) { 30 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 31 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11); 32 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 33 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); 34 } 35 if (image[0].tickmarks.objects[i].dy == 90) { 36 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 37 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text)); 38 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 39 /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */ 40 } 41 break; 42 case KII_OVERLAY_BOX: 43 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY)); 44 break; 45 case KII_OVERLAY_CIRCLE: 46 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040); 47 break; 48 default: 49 fprintf (stderr, "skipping unknown object\n"); 50 break; 27 51 } 28 if (!strcmp (image[0].tickmarks.objects[i].type, "TEXT")) {29 if (image[0].tickmarks.objects[i].dy == 0) {30 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);31 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11);32 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);33 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text));34 }35 if (image[0].tickmarks.objects[i].dy == 90) {36 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);37 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text));38 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);39 /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */40 }41 continue;42 }43 if (!strcmp (image[0].tickmarks.objects[i].type, "BOX")) {44 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY));45 continue;46 }47 if (!strcmp (image[0].tickmarks.objects[i].type, "CIRCLE")) {48 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040);49 continue;50 }51 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].tickmarks.objects[i].type);52 52 } 53 54 53 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 55 56 54 } -
trunk/Ohana/src/kapa2/src/Reconfig.c
r13320 r13479 25 25 for (i = 0; i < Nsection; i++) { 26 26 section = GetSectionByNumber (i); 27 SetGraphSize (section); 28 SetImageSize (section); 27 SetSectionSizes (section); 29 28 } 30 29 -
trunk/Ohana/src/kapa2/src/Refresh.c
r13320 r13479 21 21 for (i = 0; i < Nsection; i++) { 22 22 section = GetSectionByNumber (i); 23 DrawImage (section->image); 23 24 DrawGraph (section->graph); 24 DrawImage (section->image);25 25 } 26 26 -
trunk/Ohana/src/kapa2/src/Remap16.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define FRAC(a) ((a) - (int)(a)) 2 3 static float slope = 1.0; 4 static float start = 0.0; 5 static int MaxValue = 255; 6 7 // XXX inline this if needed 8 static int PixelLookup(float value) { 9 int out; 10 out = MIN (MAX (slope * value - start, 0), MaxValue); 11 return (out); 12 } 3 13 4 14 void Remap16 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) { … … 7 17 int i_start, i_end, j_start, j_end; 8 18 int dropback; /* this is a bit of a kludge... */ 9 int dx, dy, DX, DY ;19 int dx, dy, DX, DY, pixelN; 10 20 double expand, Rx, Ry, X, Y; 11 21 int expand_in, expand_out; 12 22 unsigned char *out_pix, *out_pix2, *data; 13 unsigned char *in_pix,*in_pix2;14 unsigned char pixel1[256], pixel2[256] , pixel3[256];23 float *imdata, *in_pix, *in_pix2; 24 unsigned char pixel1[256], pixel2[256]; 15 25 unsigned char pixvalue1, pixvalue2; 16 26 unsigned long back; 17 27 unsigned char back1, back2; 18 28 29 // local array for pixel values (is this working??) 19 30 for (i = 0; i < 256; i++) { /* set up pixel array */ 20 pixel1[i] = 0x0000ff & graphic[0].cmap[i].pixel; 21 pixel2[i] = 0x0000ff & (graphic[0].cmap[i].pixel >> 8); 22 pixel3[i] = 0x0000ff & (graphic[0].cmap[i].pixel >> 16); 31 pixel1[i] = 0x00ff & graphic[0].cmap[i].pixel; 32 pixel2[i] = 0x00ff & (graphic[0].cmap[i].pixel >> 8); 23 33 } 24 34 back = graphic[0].back; … … 26 36 back2 = 0x00ff & (back >> 8); 27 37 38 // define the color transform parameters 39 MaxValue = graphic[0].Npixels - 1; 40 if (image[0].range != 0.0) { 41 slope = graphic[0].Npixels / image[0].range; 42 start = graphic[0].Npixels * image[0].zero / image[0].range; 43 } else { 44 slope = 1.0; 45 start = image[0].zero; 46 } 47 48 // set up expansions 28 49 expand = expand_in = expand_out = 1.0; 29 50 if (image[0].expand == 0) /* set up expansions */ … … 40 61 } 41 62 63 // define the image boundaries 42 64 dx = image[0].picture.dx; 43 65 dy = image[0].picture.dy; … … 76 98 77 99 data = out_pix = (unsigned char *) image[0].picture.data; 78 in_pix = (unsigned char *) (matrix[0].buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0); 100 imdata = (float *) matrix[0].buffer; 101 in_pix = &imdata[DX*(int)MAX(Y,0) + (int)MAX(X,0)]; 79 102 80 103 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 105 128 if (expand_out == 1) { 106 129 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix+=2) { 107 out_pix[0] = pixel1[*in_pix2]; 108 out_pix[1] = pixel2[*in_pix2]; 130 pixelN = PixelLookup(*in_pix2); 131 out_pix[0] = pixel1[pixelN]; 132 out_pix[1] = pixel2[pixelN]; 109 133 } 110 134 } 111 135 else { 112 136 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= 2*expand_out) { 113 pixvalue1 = pixel1[*in_pix2]; 114 pixvalue2 = pixel2[*in_pix2]; 137 pixelN = PixelLookup(*in_pix2); 138 pixvalue1 = pixel1[pixelN]; 139 pixvalue2 = pixel2[pixelN]; 115 140 out_pix2 = out_pix; 116 141 for (jj = 0; jj < expand_out; jj++, out_pix2+=2*(dx-expand_out)) { -
trunk/Ohana/src/kapa2/src/Remap24.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define FRAC(a) ((a) - (int)(a)) 2 3 static float slope = 1.0; 4 static float start = 0.0; 5 static int MaxValue = 255; 6 7 // XXX inline this if needed 8 static int PixelLookup(float value) { 9 int out; 10 out = MIN (MAX (slope * value - start, 0), MaxValue); 11 return (out); 12 } 3 13 4 14 void Remap24 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) { … … 7 17 int i_start, i_end, j_start, j_end; 8 18 int dropback, extra; /* this is a bit of a kludge... */ 9 int dx, dy, DX, DY ;19 int dx, dy, DX, DY, pixelN; 10 20 double expand, Rx, Ry, X, Y; 11 21 int expand_in, expand_out; 12 22 unsigned char *out_pix, *out_pix2, *data; 13 unsigned char *in_pix,*in_pix2;23 float *imdata, *in_pix, *in_pix2; 14 24 unsigned char pixel1[256], pixel2[256], pixel3[256]; 15 25 unsigned char pixvalue1, pixvalue2, pixvalue3; … … 17 27 unsigned char back1, back2, back3; 18 28 29 // local arrays for pixel values 19 30 for (i = 0; i < 256; i++) { /* set up pixel array */ 20 31 pixel1[i] = 0x0000ff & graphic[0].cmap[i].pixel; … … 27 38 back3 = 0x0000ff & (back >> 16); 28 39 40 // define the color transform parameters 41 MaxValue = graphic[0].Npixels - 1; 42 if (image[0].range != 0.0) { 43 slope = graphic[0].Npixels / image[0].range; 44 start = graphic[0].Npixels * image[0].zero / image[0].range; 45 } else { 46 slope = 1.0; 47 start = image[0].zero; 48 } 49 50 // set up expansions 29 51 expand = expand_in = expand_out = 1.0; 30 52 if (image[0].expand == 0) /* set up expansions */ … … 78 100 79 101 data = out_pix = (unsigned char *) image[0].picture.data; 80 in_pix = (unsigned char *) (matrix[0].buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0); 102 imdata = (float *) matrix[0].buffer; 103 in_pix = &imdata[DX*(int)MAX(Y,0) + (int)MAX(X,0)]; 81 104 82 105 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 110 133 if (expand_out == 1) { 111 134 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix+=3) { 112 out_pix[0] = pixel1[*in_pix2]; 113 out_pix[1] = pixel2[*in_pix2]; 114 out_pix[2] = pixel3[*in_pix2]; 135 pixelN = PixelLookup(*in_pix2); 136 out_pix[0] = pixel1[pixelN]; 137 out_pix[1] = pixel2[pixelN]; 138 out_pix[2] = pixel3[pixelN]; 115 139 } 116 } 117 else { 140 } else { 118 141 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= 3*expand_out) { 119 pixvalue1 = pixel1[*in_pix2]; 120 pixvalue2 = pixel2[*in_pix2]; 121 pixvalue3 = pixel3[*in_pix2]; 142 pixelN = PixelLookup(*in_pix2); 143 pixvalue1 = pixel1[pixelN]; 144 pixvalue2 = pixel2[pixelN]; 145 pixvalue3 = pixel3[pixelN]; 122 146 out_pix2 = out_pix; 123 147 for (jj = 0; jj < expand_out; jj++, out_pix2+=3*(dx-expand_out)+extra) { -
trunk/Ohana/src/kapa2/src/Remap32.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define FRAC(a) ((a) - (int)(a)) 2 3 static float slope = 1.0; 4 static float start = 0.0; 5 static int MaxValue = 255; 6 7 // XXX inline this if needed 8 static int PixelLookup(float value) { 9 int out; 10 out = MIN (MAX (slope * value - start, 0), MaxValue); 11 return (out); 12 } 3 13 4 14 void Remap32 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) { … … 7 17 int i_start, i_end, j_start, j_end; 8 18 int dropback; /* this is a bit of a kludge... */ 9 int dx, dy, DX, DY ;19 int dx, dy, DX, DY, pixelN; 10 20 double expand, Rx, Ry, X, Y; 11 21 int expand_in, expand_out; 12 22 unsigned int *out_pix, *out_pix2; 13 unsigned char *in_pix,*in_pix2;23 float *imdata, *in_pix, *in_pix2; 14 24 unsigned long pixel[256], pixvalue; 15 25 unsigned long back; 16 26 17 for (i = 0; i < 256; i++) { /* set up pixel array */ 27 // local array for pixel values 28 for (i = 0; i < 256; i++) { 18 29 pixel[i] = graphic[0].cmap[i].pixel; 19 30 } 20 31 back = graphic[0].back; 21 32 33 // define the color transform parameters 34 MaxValue = graphic[0].Npixels - 1; 35 if (image[0].range != 0.0) { 36 slope = graphic[0].Npixels / image[0].range; 37 start = graphic[0].Npixels * image[0].zero / image[0].range; 38 } else { 39 slope = 1.0; 40 start = image[0].zero; 41 } 42 43 // set up expansions 22 44 expand = expand_in = expand_out = 1.0; 23 if (image[0].expand == 0) /* set up expansions */45 if (image[0].expand == 0) 24 46 image[0].expand = 1; 25 47 if (image[0].expand > 0) { … … 34 56 } 35 57 58 // define the image boundaries 36 59 dx = image[0].picture.dx; 37 60 dy = image[0].picture.dy; … … 69 92 70 93 out_pix = (unsigned int *) image[0].picture.data; 71 in_pix = (unsigned char *) (matrix[0].buffer) + DX*(int)MAX(Y,0) + (int)MAX(X,0); 94 imdata = (float *) matrix[0].buffer; 95 in_pix = &imdata[DX*(int)MAX(Y,0) + (int)MAX(X,0)]; 72 96 73 97 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 92 116 if (expand_out == 1) { 93 117 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix++) { 94 *out_pix = pixel[*in_pix2]; 118 pixelN = PixelLookup(*in_pix2); 119 *out_pix = pixel[pixelN]; 95 120 } 96 /* *out_pix = *(pixel + *in_pix2); */97 121 } 98 122 else { 99 123 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= expand_out) { 100 pixvalue = pixel[*in_pix2]; 124 pixelN = PixelLookup(*in_pix2); 125 pixvalue = pixel[pixelN]; 101 126 out_pix2 = out_pix; 102 127 for (jj = 0; jj < expand_out; jj++, out_pix2+=(dx-expand_out)) { -
trunk/Ohana/src/kapa2/src/Remap8.c
r13320 r13479 1 1 # include "Ximage.h" 2 # define FRAC(a) ((a) - (int)(a)) 2 3 static float slope = 1.0; 4 static float start = 0.0; 5 static int MaxValue = 255; 6 7 // XXX inline this if needed 8 static int PixelLookup(float value) { 9 int out; 10 out = MIN (MAX (slope * value - start, 0), MaxValue); 11 return (out); 12 } 3 13 4 14 void Remap8 (Graphic *graphic, KapaImageWidget *image, Matrix *matrix) { … … 7 17 int i_start, i_end, j_start, j_end; 8 18 int dropback; /* this is a bit of a kludge... */ 9 int dx, dy, DX, DY ;19 int dx, dy, DX, DY, pixelN; 10 20 double expand, Rx, Ry, X, Y; 11 21 int expand_in, expand_out; 12 22 unsigned char *out_pix, *out_pix2; 13 unsigned char*in_pix, *in_pix2;23 float *imdata, *in_pix, *in_pix2; 14 24 unsigned long pixel[256], pixvalue; 15 25 unsigned long back; 16 26 17 for (i = 0; i < 256; i++) { /* set up pixel array */ 27 // local array for pixel values 28 for (i = 0; i < 256; i++) { 18 29 pixel[i] = graphic[0].cmap[i].pixel; 19 30 } 20 31 back = graphic[0].back; 21 32 33 // define the color transform parameters 34 MaxValue = graphic[0].Npixels - 1; 35 if (image[0].range != 0.0) { 36 slope = graphic[0].Npixels / image[0].range; 37 start = graphic[0].Npixels * image[0].zero / image[0].range; 38 } else { 39 slope = 1.0; 40 start = image[0].zero; 41 } 42 43 // set up expansions 22 44 expand = expand_in = expand_out = 1.0; 23 45 if (image[0].expand == 0) /* set up expansions */ … … 34 56 } 35 57 58 // define the image boundaries 36 59 dx = image[0].picture.dx; 37 60 dy = image[0].picture.dy; 38 61 DX = matrix[0].Naxis[0]; 39 62 DY = matrix[0].Naxis[1]; 63 40 64 /* X,Y are the image coordinates of the first image pixel */ 41 65 X = MAX(0.5*(DX - dx*expand) - image[0].X, 0); … … 69 93 70 94 out_pix = (unsigned char *) image[0].picture.data; 71 in_pix = (unsigned char *) matrix[0].buffer + DX*(int)MAX(Y,0) + (int)MAX(X,0); 95 imdata = (float *) matrix[0].buffer; 96 in_pix = &imdata[(int)(DX*(int)MAX(Y,0) + (int)MAX(X,0))]; 72 97 73 98 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ … … 92 117 if (expand_out == 1) { 93 118 for (i = i_start; i < i_end; i++, in_pix2+= expand_in, out_pix++) { 94 *out_pix = pixel[*in_pix2]; 119 pixelN = PixelLookup(*in_pix2); 120 *out_pix = pixel[pixelN]; 95 121 } 96 /* *out_pix = *(pixel + *in_pix2); */ 97 } 98 else { 122 } else { 99 123 for (i = i_start; i < i_end; i+= expand_out, in_pix2++, out_pix+= expand_out) { 100 pixvalue = pixel[*in_pix2]; 124 pixelN = PixelLookup(*in_pix2); 125 pixvalue = pixel[pixelN]; 101 126 out_pix2 = out_pix; 102 127 for (jj = 0; jj < expand_out; jj++, out_pix2+=(dx-expand_out)) { -
trunk/Ohana/src/kapa2/src/Resize.c
r13320 r13479 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; … … 30 30 for (i = 0; i < Nsection; i++) { 31 31 section = GetSectionByNumber (i); 32 SetGraphSize (section); 33 SetImageSize (section); 32 SetSectionSizes (section); 34 33 } 35 34 -
trunk/Ohana/src/kapa2/src/SaveOverlay.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int SaveOverlay ( ) {3 int SaveOverlay (int sock) { 4 4 5 5 int i, N; 6 char filename[256] ;6 char filename[256], *type; 7 7 FILE *f; 8 8 Section *section; … … 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); … … 21 22 22 23 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 24 type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type); 25 if (type == NULL) continue; 23 26 fprintf (f, "%s %lf %lf %lf %lf\n", 24 image[0].overlay[N].objects[i].type,27 type, 25 28 image[0].overlay[N].objects[i].x, 26 29 image[0].overlay[N].objects[i].y, … … 31 34 return (TRUE); 32 35 } 36 37 /* this is asymmetric with LoadOverlay.c. In that case, the client reads the file and sends 38 * the overlay objects to kapa. In this case, kapa writes the file directly... 39 */ -
trunk/Ohana/src/kapa2/src/Sections.c
r13320 r13479 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; … … 149 147 return (TRUE); 150 148 } 149 150 void SetSectionSizes (Section *section) { 151 152 SetGraphSize (section); 153 SetImageSize (section); 154 return; 155 } 156 157 // return TRUE even for nonsense cases to avoid quitting kapa 158 int MoveSection (int sock) { 159 160 int i, N; 161 char name[128]; 162 char direction[16]; 163 Section *tmpSection = NULL; 164 165 KiiScanMessage (sock, "%s %s", name, direction); 166 167 N = GetSectionByName (name); 168 if (N < 0) { 169 fprintf (stderr, "section %s not found\n", name); 170 return (TRUE); 171 } 172 173 if (!strcasecmp (direction, "up")) { 174 if (N < 0) return (TRUE); 175 if (N > Nsections - 2) return (TRUE); 176 tmpSection = sections[N]; 177 sections[N] = sections[N+1]; 178 sections[N+1] = tmpSection; 179 Refresh (1); 180 return (TRUE); 181 } 182 183 if (!strcasecmp (direction, "down")) { 184 if (N < 1) return (TRUE); 185 if (N > Nsections - 1) return (TRUE); 186 tmpSection = sections[N]; 187 sections[N] = sections[N-1]; 188 sections[N-1] = tmpSection; 189 Refresh (1); 190 return (TRUE); 191 } 192 193 if (!strcasecmp (direction, "top")) { 194 if (N < 0) return (TRUE); 195 if (N > Nsections - 2) return (TRUE); 196 tmpSection = sections[N]; 197 for (i = N; i < Nsections - 1; i++) { 198 sections[i] = sections[i+1]; 199 } 200 sections[i] = tmpSection; 201 Refresh (1); 202 return (TRUE); 203 } 204 205 if (!strcasecmp (direction, "bottom")) { 206 if (N < 1) return (TRUE); 207 if (N > Nsections - 1) return (TRUE); 208 tmpSection = sections[N]; 209 for (i = N; i >= 1; i--) { 210 sections[i] = sections[i-1]; 211 } 212 sections[i] = tmpSection; 213 Refresh (1); 214 return (TRUE); 215 } 216 fprintf (stderr, "unknown direction %s for MoveSection\n", direction); 217 return (TRUE); 218 } -
trunk/Ohana/src/kapa2/src/SetFont.c
r13320 r13479 1 1 # include "Ximage.h" 2 2 3 int SetFont ( ) {3 int SetFont (int sock) { 4 4 5 5 char name[64]; -
trunk/Ohana/src/kapa2/src/SetGraphSize.c
r13320 r13479 7 7 8 8 int fontsize, bump, Nc; 9 int textpad, textdY, WdY; 9 10 double PADx, PADy, Dx, Dy; 10 11 double PXm, PXp, PYm, PYp; … … 32 33 PYp = (graph[0].axis[2].islabel) ? 4*fontsize : 0; 33 34 34 /* size of the graph in Xwindow coordinates */35 /* basic size of the graph in Xwindow coordinates */ 35 36 X0 = PADx + PXm + (Dx * section[0].x); 36 37 Y0 = PADy + PYm + (Dy * section[0].y); 37 38 dX = (Dx * section[0].dx) - PXp - PXm; 38 39 dY = (Dy * section[0].dy) - PYp - PYm; 40 41 // if we are tied to an image, make mods as needed 42 if (section->image) { 43 textpad = graphic[0].font[0].ascent; 44 textdY = 6*textpad + 7*PAD1; 45 WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1); 46 47 switch (section->image->location) { 48 case 1: 49 Y0 = graphic[0].dy * section[0].y + 2*PAD1 + WdY + 2; // tied to image in Y 50 dY = graphic[0].dy * section[0].dy - 5*PAD1 - WdY - COLORPAD + 1; 51 break; 52 case 3: 53 dY = graphic[0].dy * section[0].dy - 5*PAD1 - WdY - COLORPAD - PADy - PYm; 54 break; 55 case 2: 56 X0 = graphic[0].dx * section[0].x + 2*PAD1 + ZOOM_X; 57 dX = graphic[0].dx * section[0].dx - 3*PAD1 - ZOOM_X; 58 break; 59 case 4: 60 dX = graphic[0].dx * section[0].dx - 3*PAD1 - ZOOM_X - PADx - PXm; 61 break; 62 } 63 } 39 64 40 65 /* define locations of coordinate axes */ -
trunk/Ohana/src/kapa2/src/SetImageSize.c
r13320 r13479 7 7 void SetImageSize (Section *section) { 8 8 9 int Xs, Ys, Xe, Ye, dX, dY; 10 int textpad, textdY, WdY; 9 11 KapaImageWidget *image; 12 KapaGraphWidget *graph; 10 13 Graphic *graphic; 11 14 … … 13 16 image = section->image; 14 17 if (image == NULL) return; 18 graph = section->graph; 15 19 16 20 graphic = GetGraphic (); 17 21 18 image[0].cmapbar.dx = graphic[0].dx - 2*PAD1; 19 image[0].cmapbar.dy = COLORPAD; 20 image[0].cmapbar.x = PAD1; 21 image[0].cmapbar.y = PAD1; 22 23 image[0].zoom.dx = ZOOM_X; 24 image[0].zoom.dy = ZOOM_Y; 25 image[0].zoom.x = graphic[0].dx - PAD1 - ZOOM_X; 26 image[0].zoom.y = image[0].cmapbar.y + image[0].cmapbar.dy + PAD2; 27 28 image[0].picture.dx = image[0].zoom.x - 2*PAD1 - 25; 29 image[0].picture.dy = graphic[0].dy - 2*PAD1 - PAD2 - COLORPAD - 25; 30 image[0].picture.x = PAD1 + 25; 31 image[0].picture.y = PAD1 + PAD2 + COLORPAD; 32 33 /** everything below is tied in x-dir to the zoom box **/ 34 image[0].text_x = image[0].zoom.x; 35 image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD2; 36 37 /* image[0].PS_button.y = graphic[0].dy - BUTTON_HEIGHT - PAD1; */ 38 image[0].PS_button.x = image[0].zoom.x + 5; 39 image[0].PS_button.y = 2*ZOOM_Y; 40 41 /** everything below is tied to the PS_button in y-dir **/ 42 image[0].grey_button.x = image[0].PS_button.x + image[0].PS_button.dx + PAD1; 43 image[0].grey_button.y = image[0].PS_button.y; 44 45 image[0].rainbow_button.x = image[0].grey_button.x + image[0].grey_button.dx + PAD1; 46 image[0].rainbow_button.y = image[0].PS_button.y; 47 48 image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1; 49 image[0].puns_button.y = image[0].PS_button.y; 50 51 image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1; 52 image[0].recenter_button.y = image[0].PS_button.y; 53 54 image[0].overlay_button[0].x = image[0].zoom.x + 5; 55 image[0].overlay_button[0].y = image[0].PS_button.y - BUTTON_HEIGHT - PAD1; 22 /* the image is placed within the graphic window in region specified by section */ 23 Xs = graphic[0].dx * section[0].x; 24 Ys = graphic[0].dy * (1 - section[0].y - section[0].dy); 25 dX = graphic[0].dx * section[0].dx; 26 dY = graphic[0].dy * section[0].dy; 27 28 switch (image[0].location) { 29 case 0: 30 if (section->graph) { 31 image[0].picture.x = graph[0].axis[0].fx; 32 image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy; 33 image[0].picture.dx = MAX(graph[0].axis[0].dfx + 1, 1); 34 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 35 } else { 36 image[0].picture.x = Xs + PAD1; 37 image[0].picture.y = Ys + PAD1; 38 image[0].picture.dx = dX - 2*PAD1; 39 image[0].picture.dy = dY - 2*PAD1; 40 } 41 if (USE_XWINDOW) CreatePicture (image, graphic); 42 Remap (graphic, image, &image[0].matrix); 43 return; 44 45 case 1: 46 textpad = graphic[0].font[0].ascent; 47 textdY = 6*textpad + 7*PAD1; 48 WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1); 49 50 if (section->graph) { 51 image[0].picture.x = graph[0].axis[0].fx; 52 image[0].picture.y = Ys + 2*PAD1 + COLORPAD; 53 image[0].picture.dx = graph[0].axis[0].dfx; 54 image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD; 55 } else { 56 image[0].picture.x = Xs + PAD1; 57 image[0].picture.y = Ys + 2*PAD1 + COLORPAD; 58 image[0].picture.dx = dX - 2*PAD1; 59 image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD; 60 } 61 62 image[0].cmapbar.dx = dX - 2*PAD1; 63 image[0].cmapbar.dy = COLORPAD; 64 image[0].cmapbar.x = Xs + PAD1; 65 image[0].cmapbar.y = Ys + PAD1; 66 67 // XXX zoom should scale somewhat with the image? (with a min and a max) 68 // XXX actually, it is limited by the buttons and status region 69 image[0].zoom.dx = ZOOM_X; 70 image[0].zoom.dy = ZOOM_Y; 71 image[0].zoom.x = Xs + PAD1; 72 image[0].zoom.y = image[0].picture.y + image[0].picture.dy + PAD1; 73 74 /** everything below is tied in x-dir to the zoom box **/ 75 image[0].text_x = image[0].zoom.x + image[0].zoom.dx + PAD1; 76 image[0].text_y = image[0].zoom.y; 77 image[0].text_dx = ZOOM_X; 78 image[0].text_dy = 6*textpad + 7*PAD1; 79 80 image[0].overlay_button[0].x = image[0].text_x; 81 image[0].overlay_button[0].y = image[0].text_y + image[0].text_dy + PAD1; 56 82 57 image[0].overlay_button[1].x = image[0].overlay_button[0].x + image[0].overlay_button[0].dx + PAD1; 58 image[0].overlay_button[1].y = image[0].PS_button.y - BUTTON_HEIGHT - PAD1; 59 60 image[0].overlay_button[2].x = image[0].overlay_button[1].x + image[0].overlay_button[1].dx + PAD1; 61 image[0].overlay_button[2].y = image[0].PS_button.y - BUTTON_HEIGHT - PAD1; 62 63 image[0].overlay_button[3].x = image[0].overlay_button[2].x + image[0].overlay_button[2].dx + PAD1; 64 image[0].overlay_button[3].y = image[0].PS_button.y - BUTTON_HEIGHT - PAD1; 65 66 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 67 image[0].hms_button.y = image[0].PS_button.y - BUTTON_HEIGHT - PAD1; 83 image[0].overlay_button[1].x = image[0].overlay_button[0].x + image[0].overlay_button[0].dx + PAD1; 84 image[0].overlay_button[1].y = image[0].overlay_button[0].y; 85 86 image[0].overlay_button[2].x = image[0].overlay_button[1].x + image[0].overlay_button[1].dx + PAD1; 87 image[0].overlay_button[2].y = image[0].overlay_button[0].y; 88 89 image[0].overlay_button[3].x = image[0].overlay_button[2].x + image[0].overlay_button[2].dx + PAD1; 90 image[0].overlay_button[3].y = image[0].overlay_button[0].y; 91 92 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 93 image[0].hms_button.y = image[0].overlay_button[0].y; 94 95 image[0].PS_button.x = image[0].text_x; 96 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; 97 98 /** everything below is tied to the PS_button in y-dir + the neighbor in x-dir **/ 99 image[0].grey_button.x = image[0].PS_button.x + image[0].PS_button.dx + PAD1; 100 image[0].grey_button.y = image[0].PS_button.y; 101 102 image[0].rainbow_button.x = image[0].grey_button.x + image[0].grey_button.dx + PAD1; 103 image[0].rainbow_button.y = image[0].PS_button.y; 104 105 image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1; 106 image[0].puns_button.y = image[0].PS_button.y; 107 108 image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1; 109 image[0].recenter_button.y = image[0].PS_button.y; 110 break; 111 112 case 3: 113 textpad = graphic[0].font[0].ascent; 114 textdY = 6*textpad + 7*PAD1; 115 WdY = MAX (ZOOM_Y, textdY + 2*BUTTON_HEIGHT + PAD1); 116 117 if (section->graph) { 118 image[0].picture.x = graph[0].axis[0].fx; 119 image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy; 120 image[0].picture.dx = MAX(graph[0].axis[0].dfx, 1); 121 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 122 } else { 123 image[0].picture.dx = dX - 2*PAD1; 124 image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD; 125 image[0].picture.x = Xs + PAD1; 126 image[0].picture.y = Ys + 4*PAD1 + COLORPAD + WdY; 127 } 128 129 image[0].cmapbar.dx = dX - 2*PAD1; 130 image[0].cmapbar.dy = COLORPAD; 131 image[0].cmapbar.x = Xs + PAD1; 132 image[0].cmapbar.y = Ys + PAD1; 133 134 // XXX zoom should scale somewhat with the image? (with a min and a max) 135 // XXX actually, it is limited by the buttons and status region 136 image[0].zoom.dx = ZOOM_X; 137 image[0].zoom.dy = ZOOM_Y; 138 image[0].zoom.x = Xs + PAD1; 139 image[0].zoom.y = Ys + 2*PAD1 + COLORPAD; 140 141 /** everything below is tied in x-dir to the zoom box **/ 142 image[0].text_x = image[0].zoom.x + image[0].zoom.dx + PAD1; 143 image[0].text_y = image[0].zoom.y; 144 image[0].text_dx = ZOOM_X; 145 image[0].text_dy = 6*textpad + 7*PAD1; 146 147 image[0].overlay_button[0].x = image[0].text_x; 148 image[0].overlay_button[0].y = image[0].text_y + image[0].text_dy + PAD1; 149 150 image[0].overlay_button[1].x = image[0].overlay_button[0].x + image[0].overlay_button[0].dx + PAD1; 151 image[0].overlay_button[1].y = image[0].overlay_button[0].y; 152 153 image[0].overlay_button[2].x = image[0].overlay_button[1].x + image[0].overlay_button[1].dx + PAD1; 154 image[0].overlay_button[2].y = image[0].overlay_button[0].y; 155 156 image[0].overlay_button[3].x = image[0].overlay_button[2].x + image[0].overlay_button[2].dx + PAD1; 157 image[0].overlay_button[3].y = image[0].overlay_button[0].y; 158 159 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 160 image[0].hms_button.y = image[0].overlay_button[0].y; 161 162 image[0].PS_button.x = image[0].text_x; 163 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; 164 165 /** everything below is tied to the PS_button in y-dir + the neighbor in x-dir **/ 166 image[0].grey_button.x = image[0].PS_button.x + image[0].PS_button.dx + PAD1; 167 image[0].grey_button.y = image[0].PS_button.y; 168 169 image[0].rainbow_button.x = image[0].grey_button.x + image[0].grey_button.dx + PAD1; 170 image[0].rainbow_button.y = image[0].PS_button.y; 171 172 image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1; 173 image[0].puns_button.y = image[0].PS_button.y; 174 175 image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1; 176 image[0].recenter_button.y = image[0].PS_button.y; 177 break; 178 179 case 2: 180 181 if (section->graph) { 182 image[0].picture.x = Xs + 2*PAD1 + ZOOM_X; 183 image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy; 184 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X; 185 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 186 } else { 187 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X; 188 image[0].picture.dy = dY - 3*PAD1 - COLORPAD; 189 image[0].picture.x = Xs + 2*PAD1 + ZOOM_X; 190 image[0].picture.y = Ys + 2*PAD1 + COLORPAD; 191 } 192 193 image[0].cmapbar.dx = dX - 2*PAD1; 194 image[0].cmapbar.dy = COLORPAD; 195 image[0].cmapbar.x = Xs + PAD1; 196 image[0].cmapbar.y = Ys + PAD1; 197 198 // XXX zoom should scale somewhat with the image? (with a min and a max) 199 // XXX actually, it is limited by the buttons and status region 200 image[0].zoom.dx = ZOOM_X; 201 image[0].zoom.dy = ZOOM_Y; 202 image[0].zoom.x = Xs + PAD1; 203 image[0].zoom.y = image[0].picture.y; 204 205 /** everything below is tied in x-dir to the zoom box **/ 206 textpad = graphic[0].font[0].ascent; 207 image[0].text_x = image[0].zoom.x; 208 image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1; 209 image[0].text_dx = ZOOM_X; 210 image[0].text_dy = 6*textpad + 7*PAD1; 211 212 image[0].overlay_button[0].x = image[0].text_x; 213 image[0].overlay_button[0].y = image[0].text_y + image[0].text_dy + PAD1; 214 215 image[0].overlay_button[1].x = image[0].overlay_button[0].x + image[0].overlay_button[0].dx + PAD1; 216 image[0].overlay_button[1].y = image[0].overlay_button[0].y; 217 218 image[0].overlay_button[2].x = image[0].overlay_button[1].x + image[0].overlay_button[1].dx + PAD1; 219 image[0].overlay_button[2].y = image[0].overlay_button[0].y; 220 221 image[0].overlay_button[3].x = image[0].overlay_button[2].x + image[0].overlay_button[2].dx + PAD1; 222 image[0].overlay_button[3].y = image[0].overlay_button[0].y; 223 224 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 225 image[0].hms_button.y = image[0].overlay_button[0].y; 226 227 image[0].PS_button.x = image[0].zoom.x; 228 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; 229 230 /** everything below is tied to the PS_button in y-dir + the neighbor in x-dir **/ 231 image[0].grey_button.x = image[0].PS_button.x + image[0].PS_button.dx + PAD1; 232 image[0].grey_button.y = image[0].PS_button.y; 233 234 image[0].rainbow_button.x = image[0].grey_button.x + image[0].grey_button.dx + PAD1; 235 image[0].rainbow_button.y = image[0].PS_button.y; 236 237 image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1; 238 image[0].puns_button.y = image[0].PS_button.y; 239 240 image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1; 241 image[0].recenter_button.y = image[0].PS_button.y; 242 break; 243 244 case 4: 245 246 if (section->graph) { 247 image[0].picture.x = graph[0].axis[0].fx; 248 image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy; 249 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X - graph[0].axis[0].fx; 250 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 251 } else { 252 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X; 253 image[0].picture.dy = dY - 3*PAD1 - COLORPAD; 254 image[0].picture.x = Xs + PAD1; 255 image[0].picture.y = Ys + 2*PAD1 + COLORPAD; 256 } 257 258 image[0].cmapbar.dx = dX - 2*PAD1; 259 image[0].cmapbar.dy = COLORPAD; 260 image[0].cmapbar.x = Xs + PAD1; 261 image[0].cmapbar.y = Ys + PAD1; 262 263 // XXX zoom should scale somewhat with the image? (with a min and a max) 264 // XXX actually, it is limited by the buttons and status region 265 image[0].zoom.dx = ZOOM_X; 266 image[0].zoom.dy = ZOOM_Y; 267 image[0].zoom.x = image[0].picture.x + image[0].picture.dx + PAD1; 268 image[0].zoom.y = image[0].picture.y; 269 270 /** everything below is tied in x-dir to the zoom box **/ 271 textpad = graphic[0].font[0].ascent; 272 image[0].text_x = image[0].zoom.x; 273 image[0].text_y = image[0].zoom.y + image[0].zoom.dy + PAD1; 274 image[0].text_dx = ZOOM_X; 275 image[0].text_dy = 6*textpad + 7*PAD1; 276 277 image[0].overlay_button[0].x = image[0].text_x; 278 image[0].overlay_button[0].y = image[0].text_y + image[0].text_dy + PAD1; 279 280 image[0].overlay_button[1].x = image[0].overlay_button[0].x + image[0].overlay_button[0].dx + PAD1; 281 image[0].overlay_button[1].y = image[0].overlay_button[0].y; 282 283 image[0].overlay_button[2].x = image[0].overlay_button[1].x + image[0].overlay_button[1].dx + PAD1; 284 image[0].overlay_button[2].y = image[0].overlay_button[0].y; 285 286 image[0].overlay_button[3].x = image[0].overlay_button[2].x + image[0].overlay_button[2].dx + PAD1; 287 image[0].overlay_button[3].y = image[0].overlay_button[0].y; 288 289 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 290 image[0].hms_button.y = image[0].overlay_button[0].y; 291 292 image[0].PS_button.x = image[0].zoom.x; 293 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; 294 295 /** everything below is tied to the PS_button in y-dir + the neighbor in x-dir **/ 296 image[0].grey_button.x = image[0].PS_button.x + image[0].PS_button.dx + PAD1; 297 image[0].grey_button.y = image[0].PS_button.y; 298 299 image[0].rainbow_button.x = image[0].grey_button.x + image[0].grey_button.dx + PAD1; 300 image[0].rainbow_button.y = image[0].PS_button.y; 301 302 image[0].puns_button.x = image[0].rainbow_button.x + image[0].rainbow_button.dx + PAD1; 303 image[0].puns_button.y = image[0].PS_button.y; 304 305 image[0].recenter_button.x = image[0].puns_button.x + image[0].puns_button.dx + PAD1; 306 image[0].recenter_button.y = image[0].PS_button.y; 307 break; 308 309 default: 310 abort (); 311 break; 312 } 68 313 69 314 if (USE_XWINDOW) { -
trunk/Ohana/src/kapa2/src/SetLimits.c
r13320 r13479 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 SetSectionSizes (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; -
trunk/Ohana/src/kapa2/src/SetNormalHints.c
r13320 r13479 17 17 18 18 // XXX : can we drop the position flag 19 sizehints[0].flags = USPosition | USSize | PMinSize; 19 // sizehints[0].flags = USPosition | USSize | PMinSize; 20 sizehints[0].flags = USSize | PMinSize; 20 21 21 22 sizehints[0].base_width = graphic->dx; -
trunk/Ohana/src/kapa2/src/SetSection.c
r13320 r13479 2 2 3 3 // set active section 4 int SetSection ( ) {4 int SetSection (int sock) { 5 5 6 6 int N; -
trunk/Ohana/src/kapa2/src/UpdatePointer.c
r13320 r13479 6 6 int textpad; 7 7 double x, y, z; 8 float *data; 8 9 char line[100]; 9 10 Section *section; … … 13 14 section = GetActiveSection(); 14 15 image = section->image; 16 if (image == NULL) return (TRUE); 17 if (!image[0].location) return (TRUE); 15 18 16 19 if (image[0].MovePointer && InPicture ((XButtonEvent *)event, &image[0].picture)) { 17 20 21 data = (float *) image[0].matrix.buffer; 18 22 Screen_to_Image (&x, &y, (double)event[0].x, (double)event[0].y, image); 19 23 20 if ((x >= 0) && (x < image[0].matrix.Naxis[0]) && (y >= 0) && (y < image[0].matrix.Naxis[1])) { 21 /* 22 X = event[0].x - image[0].picture.x; 23 Y = event[0].y - image[0].picture.y; 24 pix = MIN (MAX (X + Y*image[0].picture.dx, 0), image[0].picture.dx*image[0].picture.dy - 1); 25 z = image[0].range * image[0].picture.data[pix] / image[0].Npixels + image[0].zero; 26 */ 27 z = -1; 28 } 29 else 30 z = -1; 24 z = -1; 25 if (x < 0) goto skip; 26 if (x >= image[0].matrix.Naxis[0]) goto skip; 27 if (y < 0) goto skip; 28 if (y >= image[0].matrix.Naxis[1]) goto skip; 29 z = data[(int)(y)*image[0].matrix.Naxis[0] + (int)(x)]; 30 31 skip: 31 32 image[0].x = x; 32 33 image[0].y = y; … … 43 44 CrossHairs (graphic, image); 44 45 XFlush (graphic[0].display); 45 46 46 } 47 47 … … 54 54 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 55 55 bzero (line, 100); 56 sprintf (line, "%2 5.2f", z);56 sprintf (line, "%22.3f", z); 57 57 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 58 58 image[0].text_x + PAD1, image[0].text_y + textpad + PAD1, -
trunk/Ohana/src/kapa2/src/UpdateStatusBox.c
r13320 r13479 14 14 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 15 15 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, 16 image[0].text_x, image[0].text_y, ZOOM_X, 6*textpad+7*PAD1);16 image[0].text_x, image[0].text_y, image[0].text_dx, image[0].text_dy); 17 17 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 18 18 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, 19 image[0].text_x, image[0].text_y, ZOOM_X, 6*textpad+7*PAD1);19 image[0].text_x, image[0].text_y, image[0].text_dx, image[0].text_dy); 20 20 21 21 bzero (line, 100); … … 31 31 32 32 bzero (line, 100); 33 sprintf (line, "(%s) ", image[0]. buffer_name);33 sprintf (line, "(%s) ", image[0].name); 34 34 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 35 35 image[0].text_x + PAD1, image[0].text_y + 6*textpad + 6*PAD1, line, 25); … … 38 38 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 39 39 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, 40 image[0].text_x + 1, image[0].text_y + 1, ZOOM_X - 2, 3*textpad+3*PAD1 +1);40 image[0].text_x+1, image[0].text_y+1, image[0].text_dx-2, image[0].text_dy-2); 41 41 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 42 42 } 43 43 bzero (line, 100); 44 sprintf (line, "%2 5.3f", z);44 sprintf (line, "%22.3f", z); 45 45 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 46 46 image[0].text_x + PAD1, image[0].text_y + textpad + PAD1, line, strlen(line)); 47 47 48 48 bzero (line, 100); 49 sprintf (line, "%1 2.1f %12.1f", x, y);49 sprintf (line, "%10.1f %10.1f", x, y); 50 50 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 51 51 image[0].text_x + PAD1, image[0].text_y + 2*textpad + 2*PAD1, line, strlen(line)); … … 53 53 bzero (line, 100); 54 54 if (image[0].DecimalDegrees) { 55 sprintf (line, "%1 2.6f %12.6f", ra, dec);55 sprintf (line, "%10.6f %10.6f", ra, dec); 56 56 } else { 57 57 hh_hms (line, ra, dec, ':'); -
trunk/Ohana/src/kapa2/src/bDrawIt.c
r13320 r13479 22 22 section = GetSectionByNumber (i); 23 23 bDrawGraph (section->graph); 24 // bDrawImage (section-> graph);24 // bDrawImage (section->image); 25 25 } 26 26 -
trunk/Ohana/src/kapa2/src/bDrawOverlay.c
r13320 r13479 23 23 expand = fabs((double)image[0].expand); 24 24 } 25 /*26 X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].picture.dx + 0.5) - 0.0) - image[0].X;27 Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].picture.dy + 0.5) - 0.0) - image[0].Y;28 X0 = (image[0].X + 1 - (int)(0.5*image[0].matrix.Naxis[0] + 0.5) - X + (int)X)/expand + image[0].picture.x + 0.5*image[0].picture.dx;29 Y0 = (image[0].Y + 1 - (int)(0.5*image[0].matrix.Naxis[1] + 0.5) - Y + (int)Y)/expand + image[0].picture.y + 0.5*image[0].picture.dy;30 */31 25 32 26 Image_to_Screen (&X0, &Y0, 0.0, 0.0, image); … … 62 56 for a BOX (x, y) is the center, (dx, dy) is the width */ 63 57 64 if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) { 65 bDrawLine (X, Y, (X+dX), (Y+dY)); 66 continue; 58 switch (image[0].overlay[N].objects[i].type) { 59 case KII_OVERLAY_LINE: 60 bDrawLine (X, Y, (X+dX), (Y+dY)); 61 break; 62 case KII_OVERLAY_TEXT: 63 bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0); 64 break; 65 case KII_OVERLAY_BOX: 66 dx = MAX (abs(dX),2) / 2; 67 dy = MAX (abs(dY),2) / 2; 68 bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy)); 69 // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y)); 70 break; 71 case KII_OVERLAY_CIRCLE: 72 dx = MAX (abs(dX),2); 73 dy = MAX (abs(dY),2); 74 bDrawArc (X, Y, dx, dy, 0, 360); 75 break; 76 default: 77 fprintf (stderr, "skipping unknown object\n"); 78 break; 67 79 } 68 if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {69 bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0);70 continue;71 }72 if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {73 dx = MAX (abs(dX),2) / 2;74 dy = MAX (abs(dY),2) / 2;75 bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy));76 // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y));77 continue;78 }79 if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {80 dx = MAX (abs(dX),2);81 dy = MAX (abs(dY),2);82 bDrawArc (X, Y, dx, dy, 0, 360);83 continue;84 }85 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);86 80 } 87 81 -
trunk/Ohana/src/kapa2/src/kapa.c
r13320 r13479 7 7 SetUpGraphic (&argc, argv); 8 8 9 // XXX get socket connection here?10 11 9 InitLayout (argc, argv); 12 10 EventLoop ();
Note:
See TracChangeset
for help on using the changeset viewer.
