Changeset 13333
- Timestamp:
- May 10, 2007, 9:36:17 AM (19 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 7 edited
-
Makefile (modified) (2 diffs)
-
include/globals.h (modified) (1 diff)
-
include/prototypes.h (modified) (1 diff)
-
src/CheckPipe.c (modified) (2 diffs)
-
src/InterpretKeys.c (modified) (2 diffs)
-
src/InterpretPresses.c (modified) (1 diff)
-
src/Layout.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/Makefile
r13331 r13333 52 52 $(SRC)/SetSection.$(ARCH).o $(SRC)/DefineSection.$(ARCH).o \ 53 53 $(SRC)/SetLimits.$(ARCH).o $(SRC)/SetFont.$(ARCH).o \ 54 $(SRC)/cursor.$(ARCH).o $(SRC)/Stop.$(ARCH).o \55 54 $(SRC)/Center.$(ARCH).o $(SRC)/Remap.$(ARCH).o \ 56 55 $(SRC)/Remap8.$(ARCH).o $(SRC)/Remap16.$(ARCH).o \ … … 76 75 $(SRC)/UpdatePointer.$(ARCH).o $(SRC)/JPEGit24.$(ARCH).o \ 77 76 $(SRC)/bDrawOverlay.$(ARCH).o $(SRC)/ButtonFunctions.$(ARCH).o \ 78 $(SRC)/PSimage.$(ARCH).o $(SRC)/PSPixmap.$(ARCH).o \77 $(SRC)/PSimage.$(ARCH).o $(SRC)/PSPixmap.$(ARCH).o \ 79 78 $(SRC)/PSOverlay.$(ARCH).o 80 79 -
trunk/Ohana/src/kapa2/include/globals.h
r13320 r13333 1 1 2 int HAVE_BACKING; 3 int DEBUG; 4 int USE_XWINDOW; 5 int MAP_WINDOW; 6 int FOREGROUND; 2 int ACTIVE_CURSOR; 3 int HAVE_BACKING; 4 int DEBUG; 5 int USE_XWINDOW; 6 int MAP_WINDOW; 7 int FOREGROUND; 7 8 char *NAME_WINDOW; 8 9 -
trunk/Ohana/src/kapa2/include/prototypes.h
r13331 r13333 59 59 int DefineSection PROTO(()); 60 60 int SetFont PROTO(()); 61 int cursor PROTO(());62 61 int EraseCurrentPlot PROTO(()); 63 62 int ErasePlots PROTO(()); -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r13331 r13333 30 30 31 31 /***** handle different messages ****/ 32 if (ACTIVE_CURSOR) { 33 if (strcmp (buffer, "NCUR")) { 34 fprintf (stderr, "wrong end message %s\n", buffer); 35 return (TRUE); 36 } 37 ACTIVE_CURSOR = FALSE; 38 return (TRUE); 39 } 40 32 41 if (!strcmp (buffer, "QUIT")) return (FALSE); 42 43 if (!strcmp (buffer, "CURS")) { 44 ACTIVE_CURSOR = TRUE; 45 return (TRUE); 46 } 33 47 34 48 if (!strcmp (buffer, "PSIT")) { … … 105 119 } 106 120 107 // XXX replace this with the "ActiveCursor" boolean?108 if (!strcmp (buffer, "CURS")) {109 cursor ();110 return (TRUE);111 }112 113 121 /* Erase Section */ 114 122 if (!strcmp (buffer, "ERSC")) { -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r13320 r13333 1 1 # include "Ximage.h" 2 2 3 int InterpretKeys (Graphic *graphic, X Event *event) {3 int InterpretKeys (Graphic *graphic, XKeyEvent *event) { 4 4 5 double X, Y, offset; 6 int modstate; 7 char string[10]; 8 KeySym keysym; 9 XComposeStatus composestatus; 10 XKeyEvent *keyevent; 11 Section *section; 5 double X, Y, offset; 6 int modstate; 7 char *name, string[16], line[40]; 8 KeySym keysym; 9 XComposeStatus composestatus; 10 Section *section; 12 11 KapaImageWidget *image; 12 KapaGraphWidget *graph; 13 13 14 14 // XXX select the window element which contains the event 15 15 section = GetActiveSection(); 16 16 image = section->image; 17 graph = section->graph; 17 18 18 keyevent = (XKeyEvent *) event; 19 XLookupString (keyevent, string, 9, &keysym, &composestatus); 20 modstate = keyevent[0].state; 19 XLookupString (event, string, 9, &keysym, &composestatus); 20 modstate = event[0].state; 21 21 22 // return graph coords by default, image if graph does not exist 23 // XXX allow user to choose graph or image coords 24 if (ACTIVE_CURSOR) { 25 name = XKeysymToString (keysym); 26 27 // skip the following keys: 28 if (name == NULL) goto skip_cursor; 29 if (!strcmp (name, "Shift_L")) goto skip_cursor; 30 if (!strcmp (name, "Shift_R")) goto skip_cursor; 31 if (!strcmp (name, "Control_L")) goto skip_cursor; 32 if (!strcmp (name, "Control_R")) goto skip_cursor; 33 if (!strcmp (name, "Alt_L")) goto skip_cursor; 34 if (!strcmp (name, "Alt_R")) goto skip_cursor; 35 if (!strcmp (name, "Super_L")) goto skip_cursor; 36 if (!strcmp (name, "Super_R")) goto skip_cursor; 37 if (!strcmp (name, "Caps_Lock")) goto skip_cursor; 38 if (!strcmp (name, "Pause")) goto skip_cursor; 39 if (!strcmp (name, "Continue")) goto skip_cursor; 40 if (!strcmp (name, "Num_Lock")) goto skip_cursor; 41 if (!strcmp (name, "Scroll_Lock")) goto skip_cursor; 42 if (!strcmp (name, "Print")) goto skip_cursor; 43 if (!strcmp (name, "(null)")) goto skip_cursor; 44 45 if (graph) { 46 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 47 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 48 } 49 if (image && !graph) { 50 if (event[0].x < image[0].picture.x) goto skip_cursor; 51 if (event[0].y < image[0].picture.y) goto skip_cursor; 52 if (event[0].x > image[0].picture.x + image[0].picture.dx) goto skip_cursor; 53 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 54 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 55 } 56 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 57 write (sock, line, 40); 58 } 59 60 skip_cursor: 22 61 // offset is in image pixels: 23 62 // 0.5 image pixels is 1 screen pixel for expand == +2 … … 42 81 case XK_KP_Begin: 43 82 case XK_Return: 44 Screen_to_Image (&X, &Y, (double) keyevent[0].x, (double)keyevent[0].y, image);83 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 45 84 X = 0.5*image[0].matrix.Naxis[0] - X; 46 85 Y = 0.5*image[0].matrix.Naxis[1] - Y; -
trunk/Ohana/src/kapa2/src/InterpretPresses.c
r13320 r13333 3 3 int InterpretPresses (Graphic *graphic, XButtonEvent *event) { 4 4 5 int status, done, this_button, x, y, old_cursor; 6 KeySym keysym; 7 Button *button; 8 Section *section; 5 int status, done, this_button, old_cursor; 6 char name[16], line[40]; 7 double X, Y; 8 KeySym keysym; 9 Button *button; 10 Section *section; 9 11 KapaImageWidget *image; 12 KapaGraphWidget *graph; 10 13 11 14 // XXX select the window element which contains the event 12 15 section = GetActiveSection(); 13 16 image = section->image; 17 graph = section->graph; 14 18 19 // return graph coords by default, image if graph does not exist 20 // XXX allow user to choose graph or image coords 21 if (ACTIVE_CURSOR) { 22 sprintf (name, "Button%d", event[0].button); 23 if (graph) { 24 X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min; 25 Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min; 26 } 27 if (image && !graph) { 28 if (event[0].x < image[0].picture.x) goto skip_cursor; 29 if (event[0].y < image[0].picture.y) goto skip_cursor; 30 if (event[0].x > image[0].picture.x + image[0].picture.dx) goto skip_cursor; 31 if (event[0].y > image[0].picture.y + image[0].picture.dy) goto skip_cursor; 32 33 Screen_to_Image (&X, &Y, (double)event[0].x, (double)event[0].y, image); 34 } 35 snprintf (line, 40, "%12s %12.6f %12.6f ", name, X, Y); 36 write (sock, line, 40); 37 } 38 39 skip_cursor: 15 40 status = TRUE; 16 41 this_button = event[0].button; -
trunk/Ohana/src/kapa2/src/Layout.c
r13320 r13333 21 21 sock = KiiWait (argv[1]); 22 22 } 23 24 ACTIVE_CURSOR = FALSE; 23 25 24 26 /* get the display colors */
Note:
See TracChangeset
for help on using the changeset viewer.
