IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 22, 2007, 12:23:09 PM (19 years ago)
Author:
eugene
Message:

upgrading to kapa 2.0 API, upgrades to dvo user interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/section.c

    r7917 r13479  
    11# include "data.h"
     2
     3enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL};
    24
    35int section (int argc, char **argv) {
    46 
    5   int N, List;
    6   int Ngraph, Xgraph;
     7  int N, action, kapa;
     8  char *name, *location;
    79  Graphdata graphmode;
    810  KapaSection section;
    911
    10   List = FALSE;
     12  action = NONE;
    1113  if ((N = get_argument (argc, argv, "-list"))) {
     14    action = LIST;
    1215    remove_argument (N, &argc, argv);
    13     List = TRUE;
     16  }
     17  if ((N = get_argument (argc, argv, "-up"))) {
     18    action = UP;
     19    remove_argument (N, &argc, argv);
     20  }
     21  if ((N = get_argument (argc, argv, "-down"))) {
     22    action = DOWN;
     23    remove_argument (N, &argc, argv);
     24  }
     25  if ((N = get_argument (argc, argv, "-top"))) {
     26    action = TOP;
     27    remove_argument (N, &argc, argv);
     28  }
     29  if ((N = get_argument (argc, argv, "-bottom"))) {
     30    action = BOTTOM;
     31    remove_argument (N, &argc, argv);
     32  }
     33  if ((N = get_argument (argc, argv, "-imtool"))) {
     34    action = TOOL;
     35    remove_argument (N, &argc, argv);
     36    location = argv[N];
     37    remove_argument (N, &argc, argv);
    1438  }
    1539
    16   Ngraph = -1;
     40  name = NULL;
    1741  if ((N = get_argument (argc, argv, "-n"))) {
    1842    remove_argument (N, &argc, argv);
    19     Ngraph = atof (argv[N]);
     43    name = strcreate (argv[N]);
    2044    remove_argument (N, &argc, argv);
    2145  }
    22   if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE);
     46  if (!GetGraph (&graphmode, &kapa, name)) return (FALSE);
     47  FREE (name);
    2348
    2449  /* list sections */
    25   if (argc == 1) {
    26     KapaGetSection (Xgraph, "*");
    27     gprint (GP_ERR, "USAGE: section name [x y dx dy]\n");
     50  if ((argc == 1) && (action == NONE)) {
     51    KapaGetSection (kapa, "*");
     52    gprint (GP_ERR, "USAGE: section name [x y dx dy] [options]\n");
     53    gprint (GP_ERR, "OPTIONS: -list   : show properties of all sections\n");
     54    gprint (GP_ERR, "         -up     : move section up in display stack\n");
     55    gprint (GP_ERR, "         -down   : move section down in display stack\n");
     56    gprint (GP_ERR, "         -top    : move section to top of display stack\n");
     57    gprint (GP_ERR, "         -bottom : move section to bottom of display stack\n");
     58    gprint (GP_ERR, "         -imtool (position) : set location of image zoom / status box\n");
     59    gprint (GP_ERR, "                 (position may be: -x, +x, -y, +y, none)\n");
    2860    return (TRUE);
    2961  }
     
    3163  if (argc == 2) {
    3264    /* select / show section */
    33     if (List) {
    34       KapaGetSection (Xgraph, argv[1]);
    35     } else {
    36       KapaSelectSection (Xgraph, argv[1]);
     65    switch (action) {
     66      case NONE:
     67        KapaSelectSection (kapa, argv[1]);
     68        break;
     69
     70      case UP:
     71        KapaMoveSection (kapa, argv[1], "up");
     72        break;
     73      case DOWN:
     74        KapaMoveSection (kapa, argv[1], "down");
     75        break;
     76      case TOP:
     77        KapaMoveSection (kapa, argv[1], "top");
     78        break;
     79      case BOTTOM:
     80        KapaMoveSection (kapa, argv[1], "bottom");
     81        break;
     82
     83      case TOOL:
     84        if (!strcmp(location, "-x")) {
     85          KapaSetToolbox (kapa, 1);
     86          break;
     87        }
     88        if (!strcmp(location, "+x")) {
     89          KapaSetToolbox (kapa, 3);
     90          break;
     91        }
     92        if (!strcmp(location, "-y")) {
     93          KapaSetToolbox (kapa, 2);
     94          break;
     95        }
     96        if (!strcmp(location, "+y")) {
     97          KapaSetToolbox (kapa, 4);
     98          break;
     99        }
     100        if (!strcmp(location, "none")) {
     101          KapaSetToolbox (kapa, 0);
     102          break;
     103        }
     104        gprint (GP_ERR, "unknown toolbox location %s\n", location);
     105        gprint (GP_ERR, "valid values: -x, +x, -y, +y, none\n");
     106        return (FALSE);
     107
     108      case LIST:
     109        KapaGetSection (kapa, argv[1]);
     110        break;
    37111    }
    38112    return (TRUE);
     
    46120    section.dx = atof (argv[4]);
    47121    section.dy = atof (argv[5]);
    48     KapaSetSection (Xgraph, &section);
     122    KapaSetSection (kapa, &section);
    49123    return (TRUE);
    50124  }
    51125  gprint (GP_ERR, "USAGE: section name [x y dx dy]\n");
     126  gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n");
    52127  return (FALSE);
    53128}
Note: See TracChangeset for help on using the changeset viewer.