Changeset 25296
- Timestamp:
- Sep 8, 2009, 4:28:13 PM (17 years ago)
- Location:
- branches/eam_branches/20090715/Ohana/src/kapa2
- Files:
-
- 10 edited
-
include/structures.h (modified) (1 diff)
-
src/ButtonFunctions.c (modified) (3 diffs)
-
src/Center.c (modified) (1 diff)
-
src/InterpretKeys.c (modified) (7 diffs)
-
src/LoadPicture.c (modified) (3 diffs)
-
src/MakeColormap.c (modified) (1 diff)
-
src/Reorient.c (modified) (3 diffs)
-
src/SetUpGraphic.c (modified) (1 diff)
-
src/StatusBox.c (modified) (1 diff)
-
src/UpdatePointer.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/Ohana/src/kapa2/include/structures.h
r24800 r25296 94 94 int DX, DY; // size of displayed picture (must be updated with new images...) 95 95 int expand; // zoomscale 96 double X , Y; // center of image in picture96 double Xc, Yc; // center of image in picture 97 97 char flipx, flipy; // parity (0 = +; 1 = -) 98 98 XImage *pix; -
branches/eam_branches/20090715/Ohana/src/kapa2/src/ButtonFunctions.c
r21153 r25296 44 44 int Recenter (Graphic *graphic, KapaImageWidget *image) { 45 45 46 image[0].picture.X = 0.5*image[0].image[0].matrix.Naxis[0];47 image[0].picture.Y = 0.5*image[0].image[0].matrix.Naxis[1];46 image[0].picture.Xc = 0.5*image[0].image[0].matrix.Naxis[0]; 47 image[0].picture.Yc = 0.5*image[0].image[0].matrix.Naxis[1]; 48 48 49 49 Remap (graphic, image); … … 56 56 57 57 image[0].picture.expand = 1; 58 image[0].zoom.expand = 5; 58 59 Remap (graphic, image); 59 60 Refresh (); … … 64 65 int RecenterRescale (Graphic *graphic, KapaImageWidget *image) { 65 66 66 image[0].picture.X = 0.5*image[0].image[0].matrix.Naxis[0];67 image[0].picture.Y = 0.5*image[0].image[0].matrix.Naxis[1];67 image[0].picture.Xc = 0.5*image[0].image[0].matrix.Naxis[0]; 68 image[0].picture.Yc = 0.5*image[0].image[0].matrix.Naxis[1]; 68 69 image[0].picture.expand = 1; 70 image[0].zoom.expand = 5; 69 71 70 72 Remap (graphic, image); -
branches/eam_branches/20090715/Ohana/src/kapa2/src/Center.c
r21060 r25296 16 16 if (image == NULL) return (TRUE); 17 17 18 image[0].picture.X = X; 19 image[0].picture.Y = Y; 18 // enforce integer center here? 19 image[0].picture.Xc = X; 20 image[0].picture.Yc = Y; 20 21 if ((zoom != 0) && (zoom != -1)) { 21 22 image[0].picture.expand = zoom; 23 image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*zoom)); 22 24 } 23 25 -
branches/eam_branches/20090715/Ohana/src/kapa2/src/InterpretKeys.c
r18411 r25296 93 93 SetColorScale (graphic, image); 94 94 Remap (graphic, image); 95 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);95 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 96 96 break; 97 97 … … 100 100 SetColorScale (graphic, image); 101 101 Remap (graphic, image); 102 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);102 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 103 103 break; 104 104 … … 107 107 SetColorScale (graphic, image); 108 108 Remap (graphic, image); 109 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);109 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 110 110 break; 111 111 … … 113 113 case XK_Home: 114 114 image[0].picture.expand = 1; 115 Reorient (graphic, image, image[0].picture.X, image[0].picture.Y, 0); 115 image[0].zoom.expand = 5; 116 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 116 117 break; 117 118 case XK_KP_End: 118 119 case XK_End: 119 120 image[0].picture.expand = 1; 121 image[0].zoom.expand = 5; 120 122 Reorient (graphic, image, 0.5*image[0].image[0].matrix.Naxis[0], 0.5*image[0].image[0].matrix.Naxis[1], 0); 121 123 break; … … 128 130 case XK_Prior: 129 131 case XK_KP_Prior: 130 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, +1);132 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, +1); 131 133 break; 132 134 case XK_Next: 133 135 case XK_KP_Next: 134 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, -1);136 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, -1); 135 137 break; 136 138 case XK_Up: 137 139 case XK_KP_Up: 138 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y+ offset, 0);140 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc + offset, 0); 139 141 break; 140 142 case XK_Down: 141 143 case XK_KP_Down: 142 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y- offset, 0);144 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc - offset, 0); 143 145 break; 144 146 case XK_Left: 145 147 case XK_KP_Left: 146 Reorient (graphic, image, image[0].picture.X + offset, image[0].picture.Y, 0);148 Reorient (graphic, image, image[0].picture.Xc + offset, image[0].picture.Yc, 0); 147 149 break; 148 150 case XK_Right: 149 151 case XK_KP_Right: 150 Reorient (graphic, image, image[0].picture.X - offset, image[0].picture.Y, 0);152 Reorient (graphic, image, image[0].picture.Xc - offset, image[0].picture.Yc, 0); 151 153 break; 152 154 … … 160 162 SetColorScale (graphic, image); 161 163 Remap (graphic, image); 162 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);164 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 163 165 break; 164 166 case XK_KP_Subtract: … … 171 173 SetColorScale (graphic, image); 172 174 Remap (graphic, image); 173 Reorient (graphic, image, image[0].picture.X , image[0].picture.Y, 0);175 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 174 176 break; 175 177 -
branches/eam_branches/20090715/Ohana/src/kapa2/src/LoadPicture.c
r21060 r25296 25 25 Yoffset = 0.0; 26 26 if (image[0].image[0].matrix.size) { 27 Xoffset = image[0].picture.X - 0.5*image[0].image[0].matrix.Naxis[0]; 28 Yoffset = image[0].picture.Y - 0.5*image[0].image[0].matrix.Naxis[1]; 27 // XXX enforce int center here? 28 Xoffset = image[0].picture.Xc - 0.5*image[0].image[0].matrix.Naxis[0]; 29 Yoffset = image[0].picture.Yc - 0.5*image[0].image[0].matrix.Naxis[1]; 29 30 } 30 31 … … 49 50 50 51 // reference point for image is the center pixel 51 image[0].picture.X = 0.5*header.Naxis[0] + Xoffset;52 image[0].picture.Y = 0.5*header.Naxis[1] + Yoffset;52 image[0].picture.Xc = 0.5*header.Naxis[0] + Xoffset; 53 image[0].picture.Yc = 0.5*header.Naxis[1] + Yoffset; 53 54 54 55 // choose expand for wide to guarantee we fit: … … 59 60 image[0].wide.expand = 1.0 / wx; 60 61 } 61 image[0].wide.X = 0.5*header.Naxis[0];62 image[0].wide.Y = 0.5*header.Naxis[1];62 image[0].wide.Xc = 0.5*header.Naxis[0]; 63 image[0].wide.Yc = 0.5*header.Naxis[1]; 63 64 64 65 fcntl (sock, F_SETFL, O_NONBLOCK); -
branches/eam_branches/20090715/Ohana/src/kapa2/src/MakeColormap.c
r24800 r25296 1 1 # include "Ximage.h" 2 2 3 //static char default_cmap[] = "grayscale";4 static char default_cmap[] = "heat";3 static char default_cmap[] = "grayscale"; 4 // static char default_cmap[] = "heat"; 5 5 6 6 void MakeColormap (int argc, char **argv) { -
branches/eam_branches/20090715/Ohana/src/kapa2/src/Reorient.c
r16228 r25296 7 7 picture = &image[0].picture; 8 8 9 if (picture[0].expand == 0) picture[0].expand = 1; 9 if (picture[0].expand == 0) { 10 picture[0].expand = 1; 11 image[0].zoom.expand = 5; 12 } 10 13 11 if ((picture[0].X == X) && (picture[0].Y== Y) && (mode == 0)) {14 if ((picture[0].Xc == X) && (picture[0].Yc == Y) && (mode == 0)) { 12 15 Refresh (); 13 16 XFlush (graphic[0].display); … … 17 20 switch (mode) { 18 21 case 0: 19 if ((picture[0].X != X) || (picture[0].Y!= Y)) {20 picture[0].X = X;21 picture[0].Y = Y;22 if ((picture[0].Xc != X) || (picture[0].Yc != Y)) { 23 picture[0].Xc = X; 24 picture[0].Yc = Y; 22 25 } 23 26 break; … … 25 28 picture[0].expand--; 26 29 if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = -2; 27 picture[0].X = X;28 picture[0].Y = Y;30 picture[0].Xc = X; 31 picture[0].Yc = Y; 29 32 break; 30 33 case +1: 31 34 picture[0].expand++; 32 35 if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = 1; 33 picture[0].X = X;34 picture[0].Y = Y;36 picture[0].Xc = X; 37 picture[0].Yc = Y; 35 38 break; 36 39 } 40 image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*picture[0].expand)); 37 41 38 42 Remap (graphic, image); -
branches/eam_branches/20090715/Ohana/src/kapa2/src/SetUpGraphic.c
r21153 r25296 60 60 graphic->color = KapaX11colors (graphic->display, graphic->colormap, graphic->fore, &Ncolors); 61 61 if (MAP_WINDOW) MapWindow (graphic); 62 62 63 return; 63 64 } -
branches/eam_branches/20090715/Ohana/src/kapa2/src/StatusBox.c
r16256 r25296 11 11 y = 0.5*image[0].image[0].matrix.Naxis[1]; 12 12 // z = -1; 13 image[0].zoom.X = x;14 image[0].zoom.Y = y;13 image[0].zoom.Xc = x; 14 image[0].zoom.Yc = y; 15 15 // image[0].z = z; 16 16 } else { 17 x = image[0].zoom.X ;18 y = image[0].zoom.Y ;17 x = image[0].zoom.Xc; 18 y = image[0].zoom.Yc; 19 19 // z = image[0].z; 20 20 } -
branches/eam_branches/20090715/Ohana/src/kapa2/src/UpdatePointer.c
r16256 r25296 29 29 30 30 skip: 31 image[0].zoom.X = x;32 image[0].zoom.Y = y;31 image[0].zoom.Xc = x; 32 image[0].zoom.Yc = y; 33 33 34 34 UpdateStatusBox (graphic, image, x, y, z, 0); … … 36 36 37 37 CreateZoom (graphic, image); 38 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 39 image[0].zoom.pix, 0, 0, 40 image[0].zoom.x, image[0].zoom.y, 41 image[0].zoom.dx, image[0].zoom.dy); 38 if (image[0].zoom.pix) { 39 XPutImage (graphic[0].display, graphic[0].window, graphic[0].gc, 40 image[0].zoom.pix, 0, 0, 41 image[0].zoom.x, image[0].zoom.y, 42 image[0].zoom.dx, image[0].zoom.dy); 43 } 42 44 CrossHairs (graphic, &image[0].zoom); 43 45 XFlush (graphic[0].display);
Note:
See TracChangeset
for help on using the changeset viewer.
