Changeset 13479 for trunk/Ohana/src/opihi/cmd.data/section.c
- Timestamp:
- May 22, 2007, 12:23:09 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/section.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/section.c
r7917 r13479 1 1 # include "data.h" 2 3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL}; 2 4 3 5 int section (int argc, char **argv) { 4 6 5 int N, List;6 int Ngraph, Xgraph;7 int N, action, kapa; 8 char *name, *location; 7 9 Graphdata graphmode; 8 10 KapaSection section; 9 11 10 List = FALSE;12 action = NONE; 11 13 if ((N = get_argument (argc, argv, "-list"))) { 14 action = LIST; 12 15 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); 14 38 } 15 39 16 Ngraph = -1;40 name = NULL; 17 41 if ((N = get_argument (argc, argv, "-n"))) { 18 42 remove_argument (N, &argc, argv); 19 Ngraph = atof(argv[N]);43 name = strcreate (argv[N]); 20 44 remove_argument (N, &argc, argv); 21 45 } 22 if (!GetGraph (&graphmode, &Xgraph, &Ngraph)) return (FALSE); 46 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 47 FREE (name); 23 48 24 49 /* 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"); 28 60 return (TRUE); 29 61 } … … 31 63 if (argc == 2) { 32 64 /* 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; 37 111 } 38 112 return (TRUE); … … 46 120 section.dx = atof (argv[4]); 47 121 section.dy = atof (argv[5]); 48 KapaSetSection ( Xgraph, §ion);122 KapaSetSection (kapa, §ion); 49 123 return (TRUE); 50 124 } 51 125 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 126 gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n"); 52 127 return (FALSE); 53 128 }
Note:
See TracChangeset
for help on using the changeset viewer.
