Changeset 29539 for trunk/Ohana/src/kapa2/src/SetImageSize.c
- Timestamp:
- Oct 25, 2010, 12:44:51 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa2/src/SetImageSize.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/SetImageSize.c
r16810 r29539 1 # include "Ximage.h"1 # include "Ximage.h" 2 2 3 3 /* Set the dimensions of the specific image based on the current window size. The image … … 9 9 int Xs, Ys, dX, dY; 10 10 int textpad, textdY, WdY; 11 int haveGraph; 11 12 KapaImageWidget *image; 12 13 KapaGraphWidget *graph; … … 17 18 if (image == NULL) return; 18 19 graph = section->graph; 20 haveGraph = graph && graph->haveGraph; 19 21 20 22 graphic = GetGraphic (); … … 33 35 34 36 case 0: // no zoom / status / wide 35 if ( section->graph) {37 if (haveGraph) { 36 38 image[0].picture.x = graph[0].axis[0].fx; 37 39 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); 39 41 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 40 42 } else { 41 43 image[0].picture.x = Xs + PAD1; 42 44 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; 45 47 } 46 48 if (USE_XWINDOW) CreatePicture (image, graphic); … … 48 50 return; 49 51 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; 62 64 } 63 65 … … 72 74 image[0].zoom.dy = ZOOM_Y; 73 75 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; 75 77 76 78 /** everything below is tied in x-dir to the zoom box **/ … … 96 98 image[0].hms_button.y = image[0].overlay_button[0].y; 97 99 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 98 103 image[0].PS_button.x = image[0].text_x; 99 104 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; … … 127 132 break; 128 133 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) { 132 137 image[0].picture.x = graph[0].axis[0].fx; 133 138 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); 135 140 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 136 141 } else { 137 image[0].picture.dx = dX - 2*PAD1;138 image[0].picture.dy = dY - 5*PAD1 - WdY - COLORPAD;139 142 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; 141 146 } 142 147 … … 175 180 image[0].hms_button.y = image[0].overlay_button[0].y; 176 181 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 177 185 image[0].PS_button.x = image[0].text_x; 178 186 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; … … 206 214 break; 207 215 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; 212 220 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); 214 222 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 215 223 } else { 216 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X;217 image[0].picture.dy = dY - 3*PAD1 - COLORPAD;218 224 image[0].picture.x = Xs + 2*PAD1 + ZOOM_X; 219 225 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; 220 228 } 221 229 … … 230 238 image[0].zoom.dy = ZOOM_Y; 231 239 image[0].zoom.x = Xs + PAD1; 232 image[0].zoom.y = image[0].picture.y;240 image[0].zoom.y = Ys + 2*PAD1 + COLORPAD; 233 241 234 242 /** everything below is tied in x-dir to the zoom box **/ … … 254 262 image[0].hms_button.y = image[0].overlay_button[0].y; 255 263 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 256 267 image[0].PS_button.x = image[0].zoom.x; 257 268 image[0].PS_button.y = image[0].overlay_button[0].y + BUTTON_HEIGHT + PAD1; … … 285 296 break; 286 297 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) { 290 301 image[0].picture.x = graph[0].axis[0].fx; 291 302 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); 293 304 image[0].picture.dy = MAX(fabs(graph[0].axis[1].dfy) - 1, 1); 294 305 } else { 295 image[0].picture.dx = dX - 3*PAD1 - ZOOM_X;296 image[0].picture.dy = dY - 3*PAD1 - COLORPAD;297 306 image[0].picture.x = Xs + PAD1; 298 307 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; 299 310 } 300 311 … … 308 319 image[0].zoom.dx = ZOOM_X; 309 320 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; 312 323 313 324 /** everything below is tied in x-dir to the zoom box **/ … … 332 343 image[0].hms_button.x = image[0].overlay_button[3].x + image[0].overlay_button[3].dx + PAD1; 333 344 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; 334 348 335 349 image[0].PS_button.x = image[0].zoom.x;
Note:
See TracChangeset
for help on using the changeset viewer.
