IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25296


Ignore:
Timestamp:
Sep 8, 2009, 4:28:13 PM (17 years ago)
Author:
eugene
Message:

minor structure element rename; fix zoom-box zoom scale

Location:
branches/eam_branches/20090715/Ohana/src/kapa2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/Ohana/src/kapa2/include/structures.h

    r24800 r25296  
    9494  int      DX, DY;            // size of displayed picture (must be updated with new images...)
    9595  int      expand;            // zoomscale
    96   double   X,  Y;             // center of image in picture
     96  double   Xc,  Yc;           // center of image in picture
    9797  char     flipx, flipy;      // parity (0 = +; 1 = -)
    9898  XImage  *pix;
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/ButtonFunctions.c

    r21153 r25296  
    4444int Recenter (Graphic *graphic, KapaImageWidget *image) {
    4545
    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];
    4848 
    4949  Remap (graphic, image);
     
    5656
    5757  image[0].picture.expand = 1;
     58  image[0].zoom.expand = 5;
    5859  Remap (graphic, image);
    5960  Refresh ();
     
    6465int RecenterRescale (Graphic *graphic, KapaImageWidget *image) {
    6566
    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];
    6869  image[0].picture.expand = 1;
     70  image[0].zoom.expand = 5;
    6971 
    7072  Remap (graphic, image);
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/Center.c

    r21060 r25296  
    1616  if (image == NULL) return (TRUE);
    1717
    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;
    2021  if ((zoom != 0) && (zoom != -1)) {
    2122    image[0].picture.expand = zoom;
     23    image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*zoom));
    2224  }
    2325
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/InterpretKeys.c

    r18411 r25296  
    9393      SetColorScale (graphic, image);
    9494      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);
    9696      break;
    9797
     
    100100      SetColorScale (graphic, image);
    101101      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);
    103103      break;
    104104
     
    107107      SetColorScale (graphic, image);
    108108      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);
    110110      break;
    111111
     
    113113    case XK_Home:
    114114      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);
    116117      break;
    117118    case XK_KP_End:
    118119    case XK_End:
    119120      image[0].picture.expand = 1;
     121      image[0].zoom.expand = 5;
    120122      Reorient (graphic, image, 0.5*image[0].image[0].matrix.Naxis[0], 0.5*image[0].image[0].matrix.Naxis[1], 0);
    121123      break;
     
    128130    case XK_Prior:
    129131    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);
    131133      break;
    132134    case XK_Next:
    133135    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);
    135137      break;
    136138    case XK_Up:
    137139    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);
    139141      break;
    140142    case XK_Down:
    141143    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);
    143145      break;
    144146    case XK_Left:
    145147    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);
    147149      break;
    148150    case XK_Right:
    149151    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);
    151153      break;
    152154
     
    160162      SetColorScale (graphic, image);
    161163      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);
    163165      break;
    164166    case XK_KP_Subtract:
     
    171173      SetColorScale (graphic, image);
    172174      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);
    174176      break;
    175177
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/LoadPicture.c

    r21060 r25296  
    2525  Yoffset = 0.0;
    2626  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];
    2930  }
    3031
     
    4950
    5051  // 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;
    5354
    5455  // choose expand for wide to guarantee we fit:
     
    5960    image[0].wide.expand = 1.0 / wx;
    6061  }   
    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];
    6364
    6465  fcntl (sock, F_SETFL, O_NONBLOCK); 
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/MakeColormap.c

    r24800 r25296  
    11# include "Ximage.h"
    22
    3 // static char default_cmap[] = "grayscale";
    4 static char default_cmap[] = "heat";
     3static char default_cmap[] = "grayscale";
     4// static char default_cmap[] = "heat";
    55
    66void MakeColormap (int argc, char **argv) {
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/Reorient.c

    r16228 r25296  
    77  picture = &image[0].picture;
    88
    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  }
    1013
    11   if ((picture[0].X == X) && (picture[0].Y == Y) && (mode == 0)) {
     14  if ((picture[0].Xc == X) && (picture[0].Yc == Y) && (mode == 0)) {
    1215    Refresh ();
    1316    XFlush (graphic[0].display);
     
    1720  switch (mode) {
    1821  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;
    2225    }
    2326    break;
     
    2528    picture[0].expand--;
    2629    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;
    2932    break;
    3033  case +1:
    3134    picture[0].expand++;
    3235    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;
    3538    break;
    3639  }
     40  image[0].zoom.expand = MIN(image[0].zoom.dx / 5.5, MAX(5, 2*picture[0].expand));
    3741
    3842  Remap (graphic, image);
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/SetUpGraphic.c

    r21153 r25296  
    6060  graphic->color = KapaX11colors (graphic->display, graphic->colormap, graphic->fore, &Ncolors);
    6161  if (MAP_WINDOW) MapWindow (graphic);
     62
    6263  return;
    6364}
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/StatusBox.c

    r16256 r25296  
    1111    y = 0.5*image[0].image[0].matrix.Naxis[1];
    1212    // 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;
    1515    // image[0].z = z;
    1616  } 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;
    1919    // z = image[0].z;
    2020  }
  • branches/eam_branches/20090715/Ohana/src/kapa2/src/UpdatePointer.c

    r16256 r25296  
    2929
    3030  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;
    3333   
    3434    UpdateStatusBox (graphic, image, x, y, z, 0);
     
    3636     
    3737    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    }
    4244    CrossHairs (graphic, &image[0].zoom);
    4345    XFlush (graphic[0].display);
Note: See TracChangeset for help on using the changeset viewer.