Changeset 5846 for trunk/Ohana/src/opihi/cmd.data/cursor.c
- Timestamp:
- Dec 27, 2005, 5:06:32 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/cursor.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/cursor.c
r5349 r5846 3 3 int cursor (int argc, char **argv) { 4 4 5 char buffer[40], string[20], key[20], keyname[20];5 char string[20], key[20]; 6 6 int i, N, Nsource, Source, IsImage; 7 7 double X, Y, R, D, Z; … … 42 42 if (IsImage) buf = SelectBuffer (GetImageName(), OLDBUFFER, FALSE); 43 43 44 sprintf (string, "CURS"); 45 write (Source, string, 4); /* ask Source to look for the keystrokes */ 44 KiiCursorOn (Source); 46 45 47 46 oldsignal = signal (SIGINT, handle_interrupt); … … 49 48 Z = -1.0; 50 49 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 51 bzero (buffer, 40); 52 read (Source, buffer, 40); 53 buffer[39] = 0; 54 sscanf (buffer, "%s %lf %lf", key, &X, &Y); 55 if (ispunct(key[0])) { 56 strcpy (keyname, "_"); 57 } else { 58 strcpy (keyname, key); 59 } 60 sprintf (string, "X%s", keyname); 50 KiiCursorRead (Source, &X, &Y, key); 51 52 sprintf (string, "X%s", key); 61 53 set_variable (string, X); 62 sprintf (string, "Y%s", key name);54 sprintf (string, "Y%s", key); 63 55 set_variable (string, Y); 64 56 set_str_variable ("KEY", key); 65 57 66 if (IsImage && (buf != NULL))67 Z = fits_get_matrix_value (&buf[0].matrix, (int)X, (int)Y);68 69 if (!IsImage) {70 XY_to_RD (&R, &D, X, Y, &graphmode.coords);71 sprintf (string, "R%s", keyname);72 set_variable (string, R);73 sprintf (string, "D%s", keyname);74 set_variable (string, D);75 }76 77 /* I still don't like this, but I have to decide which to print... */78 58 if (IsImage) { 59 if (buf != NULL) { 60 Z = fits_get_matrix_value (&buf[0].matrix, (int) X, (int) Y); 61 } 79 62 fprintf (GetOutfile(), "%s %f %f %f\n", key, X, Y, Z); 80 63 } else { 64 XY_to_RD (&R, &D, X, Y, &graphmode.coords); 65 sprintf (string, "R%s", key); 66 set_variable (string, R); 67 sprintf (string, "D%s", key); 68 set_variable (string, D); 81 69 fprintf (GetOutfile(), "%s %f %f\n", key, X, Y); 82 70 } 83 84 if (!strcasecmp (key, "Q")) { 85 signal (SIGINT, (void *) oldsignal); 86 write (Source, "NCUR", 4); /* ask Source to stop looking for the keystrokes */ 87 return (TRUE); 88 } 89 71 if (!strcasecmp (key, "Q")) break; 90 72 } 91 73 92 74 signal (SIGINT, oldsignal); 93 write (Source, "NCUR", 4); /* ask Source to look for the keystrokes */75 KiiCursorOff (Source); 94 76 return (TRUE); 95 96 77 }
Note:
See TracChangeset
for help on using the changeset viewer.
