IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2010, 12:44:51 PM (16 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20100823

File:
1 edited

Legend:

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

    r16810 r29539  
    1 # include "Ximage.h"
     1 # include "Ximage.h"
    22
    33/* Set the dimensions of the specific image based on the current window size.  The image
     
    99  int Xs, Ys, dX, dY;
    1010  int textpad, textdY, WdY;
     11  int haveGraph;
    1112  KapaImageWidget *image;
    1213  KapaGraphWidget *graph;
     
    1718  if (image == NULL) return;
    1819  graph = section->graph;
     20  haveGraph = graph && graph->haveGraph;
    1921
    2022  graphic = GetGraphic ();
     
    3335
    3436    case 0: // no zoom / status / wide
    35       if (section->graph) {
     37      if (haveGraph) {
    3638          image[0].picture.x  = graph[0].axis[0].fx;
    3739          image[0].picture.y  = graph[0].axis[1].fy + graph[0].axis[1].dfy;
    38           image[0].picture.dx = MAX(graph[0].axis[0].dfx + 1, 1);
     40          image[0].picture.dx = MAX(fabs(graph[0].axis[0].dfx) - 1, 1);
    3941          image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1);
    4042      } else {
    4143          image[0].picture.x  = Xs + PAD1;
    4244          image[0].picture.y  = Ys + PAD1;
    43           image[0].picture.dx = dX - 2*PAD1;
    44           image[0].picture.dy = dY - 2*PAD1;
     45          image[0].picture.dx = dX - 2*PAD1 - 1;
     46          image[0].picture.dy = dY - 2*PAD1 - 1;
    4547      }
    4648      if (USE_XWINDOW) CreatePicture (image, graphic);
     
    4850      return;
    4951
    50     case 1: // zoom / status / wide on bottom
    51 
    52       if (section->graph) {
    53           image[0].picture.x = graph[0].axis[0].fx;
    54           image[0].picture.y = Ys + 2*PAD1 + COLORPAD;
    55           image[0].picture.dx = graph[0].axis[0].dfx;
    56           image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD;
    57       } else {
    58           image[0].picture.x  = Xs + PAD1;
    59           image[0].picture.y  = Ys + 2*PAD1 + COLORPAD;
    60           image[0].picture.dx = dX - 2*PAD1;
    61           image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD;
     52    case 1: // zoom / status / wide on bottom (-x)
     53
     54      if (haveGraph) {
     55        image[0].picture.x = graph[0].axis[0].fx;
     56        image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy;
     57        image[0].picture.dx = MAX(fabs(graph[0].axis[0].dfx) - 1, 1);
     58        image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1);
     59      } else {
     60        image[0].picture.x  = Xs + PAD1;
     61        image[0].picture.y  = Ys + 2*PAD1 + COLORPAD;
     62        image[0].picture.dx = dX - 2*PAD1 - 1;
     63        image[0].picture.dy = dY - 4*PAD1 - 1 - WdY - COLORPAD;
    6264      }
    6365
     
    7274      image[0].zoom.dy = ZOOM_Y;
    7375      image[0].zoom.x = Xs + PAD1;
    74       image[0].zoom.y = image[0].picture.y + image[0].picture.dy + PAD1;
     76      image[0].zoom.y = Ys + dY - PAD1 - WdY;
    7577
    7678      /** everything below is tied in x-dir to the zoom box **/
     
    9698      image[0].hms_button.y = image[0].overlay_button[0].y;
    9799
     100      image[0].hex_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1;
     101      image[0].hex_button.y = image[0].overlay_button[0].y + image[0].hms_button.dy + 1;
     102
    98103      image[0].PS_button.x = image[0].text_x;
    99104      image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1;
     
    127132      break;
    128133
    129     case 3: // zoom / status / wide on top
    130 
    131       if (section->graph) {
     134    case 3: // zoom / status / wide on top (+x)
     135
     136      if (haveGraph) {
    132137        image[0].picture.x = graph[0].axis[0].fx;
    133138        image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy;
    134         image[0].picture.dx = MAX(graph[0].axis[0].dfx, 1);
     139        image[0].picture.dx = MAX(fabs(graph[0].axis[0].dfx) - 1, 1);
    135140        image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1);
    136141      } else {
    137         image[0].picture.dx = dX - 2*PAD1;
    138         image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD;
    139142        image[0].picture.x = Xs + PAD1;
    140         image[0].picture.y = Ys + 4*PAD1 + COLORPAD + WdY;
     143        image[0].picture.y = Ys + 3*PAD1 + COLORPAD + WdY;
     144        image[0].picture.dx = dX - 2*PAD1 - 1;
     145        image[0].picture.dy = dY - 4*PAD1 - 1 - WdY - COLORPAD;
    141146      }
    142147
     
    175180      image[0].hms_button.y = image[0].overlay_button[0].y;
    176181
     182      image[0].hex_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1;
     183      image[0].hex_button.y = image[0].overlay_button[0].y + image[0].hms_button.dy + 1;
     184
    177185      image[0].PS_button.x = image[0].text_x;
    178186      image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1;
     
    206214      break;
    207215
    208     case 2: // zoom / status / wide on left
    209 
    210       if (section->graph) {
    211         image[0].picture.x = Xs + 2*PAD1 + ZOOM_X;
     216    case 2: // zoom / status / wide on left (-y)
     217
     218      if (haveGraph) {
     219        image[0].picture.x = graph[0].axis[0].fx;
    212220        image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy;
    213         image[0].picture.dx = dX - 3*PAD1 - ZOOM_X;
     221        image[0].picture.dx = MAX(fabs(graph[0].axis[0].dfx) - 1, 1);
    214222        image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1);
    215223      } else {
    216         image[0].picture.dx = dX - 3*PAD1 - ZOOM_X;
    217         image[0].picture.dy = dY - 3*PAD1 - COLORPAD;
    218224        image[0].picture.x = Xs + 2*PAD1 + ZOOM_X;
    219225        image[0].picture.y = Ys + 2*PAD1 + COLORPAD;
     226        image[0].picture.dx = dX - 3*PAD1 - 1 - ZOOM_X;
     227        image[0].picture.dy = dY - 3*PAD1 - 1 - COLORPAD;
    220228      }
    221229
     
    230238      image[0].zoom.dy = ZOOM_Y;
    231239      image[0].zoom.x = Xs + PAD1;
    232       image[0].zoom.y = image[0].picture.y;
     240      image[0].zoom.y = Ys + 2*PAD1 + COLORPAD;
    233241
    234242      /** everything below is tied in x-dir to the zoom box **/
     
    254262      image[0].hms_button.y = image[0].overlay_button[0].y;
    255263
     264      image[0].hex_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1;
     265      image[0].hex_button.y = image[0].overlay_button[0].y + image[0].hms_button.dy + 1;
     266
    256267      image[0].PS_button.x = image[0].zoom.x;
    257268      image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1;
     
    285296      break;
    286297
    287     case 4:  // zoom / status / wide on right
    288 
    289       if (section->graph) {
     298    case 4:  // zoom / status / wide on right (+y)
     299
     300      if (haveGraph) {
    290301        image[0].picture.x = graph[0].axis[0].fx;
    291302        image[0].picture.y = graph[0].axis[1].fy + graph[0].axis[1].dfy;
    292         image[0].picture.dx = dX - 3*PAD1 - ZOOM_X - graph[0].axis[0].fx;
     303        image[0].picture.dx = MAX(fabs(graph[0].axis[0].dfx) - 1, 1);
    293304        image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1);
    294305      } else {
    295         image[0].picture.dx = dX - 3*PAD1 - ZOOM_X;
    296         image[0].picture.dy = dY - 3*PAD1 - COLORPAD;
    297306        image[0].picture.x = Xs + PAD1;
    298307        image[0].picture.y = Ys + 2*PAD1 + COLORPAD;
     308        image[0].picture.dx = dX - 3*PAD1 - 1 - ZOOM_X;
     309        image[0].picture.dy = dY - 3*PAD1 - 1 - COLORPAD;
    299310      }
    300311
     
    308319      image[0].zoom.dx = ZOOM_X;
    309320      image[0].zoom.dy = ZOOM_Y;
    310       image[0].zoom.x = image[0].picture.x + image[0].picture.dx + PAD1;
    311       image[0].zoom.y = image[0].picture.y;
     321      image[0].zoom.x = Xs + dX - ZOOM_X - PAD1;
     322      image[0].zoom.y = Ys + 2*PAD1 + COLORPAD;
    312323
    313324      /** everything below is tied in x-dir to the zoom box **/
     
    332343      image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1;
    333344      image[0].hms_button.y = image[0].overlay_button[0].y;
     345
     346      image[0].hex_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1;
     347      image[0].hex_button.y = image[0].overlay_button[0].y + image[0].hms_button.dy + 1;
    334348
    335349      image[0].PS_button.x = image[0].zoom.x;
Note: See TracChangeset for help on using the changeset viewer.