IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 24, 2008, 5:45:18 PM (18 years ago)
Author:
eugene
Message:

cleaning up the image/screen relationships and remap functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/src/Reorient.c

    r16011 r16228  
    33void Reorient (Graphic *graphic, KapaImageWidget *image, double X, double Y, int mode) {
    44
    5   if (image[0].expand == 0) image[0].expand = 1;
     5  Picture *picture;
    66
    7   if ((image[0].X == X) && (image[0].Y == Y) && (mode == 0)) {
     7  picture = &image[0].picture;
     8
     9  if (picture[0].expand == 0) picture[0].expand = 1;
     10
     11  if ((picture[0].X == X) && (picture[0].Y == Y) && (mode == 0)) {
    812    Refresh ();
    913    XFlush (graphic[0].display);
     
    1317  switch (mode) {
    1418  case 0:
    15     if ((image[0].X != X) || (image[0].Y != Y)) {
    16       image[0].X = X;
    17       image[0].Y = Y;
     19    if ((picture[0].X != X) || (picture[0].Y != Y)) {
     20      picture[0].X = X;
     21      picture[0].Y = Y;
    1822    }
    1923    break;
    2024  case -1:
    21     image[0].expand--;
    22     if ((image[0].expand == 0) || (image[0].expand == -1))
    23       image[0].expand = -2;
    24     if (image[0].expand < -30) {
    25       fprintf (stderr, "can't get smaller!\n");
    26       image[0].expand = -30;
    27       return;
    28     }
    29     image[0].X = X;
    30     image[0].Y = Y;
     25    picture[0].expand--;
     26    if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = -2;
     27    picture[0].X = X;
     28    picture[0].Y = Y;
    3129    break;
    3230  case +1:
    33     image[0].expand++;
    34     if ((image[0].expand == 0) || (image[0].expand == -1))
    35       image[0].expand = 1;
    36     if (image[0].expand > 30) {
    37       fprintf (stderr, "can't get bigger!\n");
    38       image[0].expand = 30;
    39       return;
    40     }
    41     image[0].X = X;
    42     image[0].Y = Y;
     31    picture[0].expand++;
     32    if ((picture[0].expand == 0) || (picture[0].expand == -1)) picture[0].expand = 1;
     33    picture[0].X = X;
     34    picture[0].Y = Y;
    4335    break;
    4436  }
     
    4941  XFlush (graphic[0].display);
    5042}
    51 
    52 # if (0) /* the "warp" function seems to be a problem on SUNs for some reason */
    53   XQueryPointer (graphic[0].display, graphic[0].window, &dummy1, &dummy1, &dummy2, &dummy2, &x, &y, &dummy3);
    54   if ((x > image[0].picture.x) && (x < image[0].picture.x + image[0].picture.dx) &&
    55       (y > image[0].picture.y) && (y < image[0].picture.y + image[0].picture.dy) &&
    56       ((mouse_event[0].button == 2) || (mouse_event[0].button == 3))) {
    57     XWarpPointer (graphic[0].display, None, graphic[0].window, 0, 0, 0, 0,
    58                   image[0].picture.x + 0.5*image[0].picture.dx,
    59                   image[0].picture.y + 0.5*image[0].picture.dy);
    60   }
    61 # endif
    62 
Note: See TracChangeset for help on using the changeset viewer.