give the three status condition columns the same width */
| 2468 | |
| 2469 | /* give the three status condition columns the same width */ |
| 2470 | static void |
| 2471 | fixup_cond_widths(void) |
| 2472 | { |
| 2473 | int pass, i, *ip, w1, w2; |
| 2474 | |
| 2475 | w1 = w2 = 0; |
| 2476 | for (pass = 1; pass <= 2; ++pass) { /* two passes... */ |
| 2477 | for (i = 0; i < 3; i++) { /* three columns */ |
| 2478 | for (ip = status_indices[i]; *ip != -1; ++ip) { /* X fields */ |
| 2479 | /* pass 1: find -1; pass 2: update field widths, find -1 */ |
| 2480 | if (pass == 2) |
| 2481 | set_widths(&shown_stats[*ip], w1, w2); |
| 2482 | } |
| 2483 | /* found -1; the two slots beyond it contain column widths */ |
| 2484 | if (pass == 1) { /* pass 1: collect maxima */ |
| 2485 | if (ip[1] > w1) |
| 2486 | w1 = ip[1]; |
| 2487 | if (ip[2] > w2) |
| 2488 | w2 = ip[2]; |
| 2489 | } else { /* pass 2: update column widths with maxima */ |
| 2490 | ip[1] = w1; |
| 2491 | ip[2] = w2; |
| 2492 | } |
| 2493 | } |
| 2494 | /* ascetics: expand the maximum width to make cond columns wider */ |
| 2495 | if (pass == 1) { |
| 2496 | w1 += 15; |
| 2497 | if (w2 > 0) |
| 2498 | w2 += 15; |
| 2499 | } |
| 2500 | } |
| 2501 | |
| 2502 | { |
| 2503 | Arg args[3]; |
| 2504 | Dimension vers_width = 0; |
| 2505 | struct X_status_value *sv = &shown_stats[F_VERS]; |
| 2506 | |
| 2507 | if (sv) { |
| 2508 | XtSetArg(args[0], XtNwidth, &vers_width); |
| 2509 | XtGetValues(sv->w, args, ONE); |
| 2510 | if (vers_width) { |
| 2511 | vers_width *= 3; |
| 2512 | XtSetArg(args[0], XtNwidth, vers_width); |
| 2513 | XtSetArg(args[1], nhStr(XtNjustify), XtJustifyRight); |
| 2514 | XtSetValues(sv->w, args, TWO); |
| 2515 | } |
| 2516 | } |
| 2517 | } |
| 2518 | } |
| 2519 | |
| 2520 | /* |
| 2521 | * Create the layout for the fancy status. Return a form widget that |
no test coverage detected