IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13333


Ignore:
Timestamp:
May 10, 2007, 9:36:17 AM (19 years ago)
Author:
eugene
Message:

added Active Cursor mode

Location:
trunk/Ohana/src/kapa2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/Makefile

    r13331 r13333  
    5252$(SRC)/SetSection.$(ARCH).o               $(SRC)/DefineSection.$(ARCH).o      \
    5353$(SRC)/SetLimits.$(ARCH).o                $(SRC)/SetFont.$(ARCH).o            \
    54 $(SRC)/cursor.$(ARCH).o                   $(SRC)/Stop.$(ARCH).o               \
    5554$(SRC)/Center.$(ARCH).o                   $(SRC)/Remap.$(ARCH).o              \
    5655$(SRC)/Remap8.$(ARCH).o                   $(SRC)/Remap16.$(ARCH).o            \
     
    7675$(SRC)/UpdatePointer.$(ARCH).o            $(SRC)/JPEGit24.$(ARCH).o           \
    7776$(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           \
    7978$(SRC)/PSOverlay.$(ARCH).o
    8079
  • trunk/Ohana/src/kapa2/include/globals.h

    r13320 r13333  
    11
    2 int HAVE_BACKING;
    3 int DEBUG;
    4 int USE_XWINDOW;
    5 int MAP_WINDOW;
    6 int FOREGROUND;
     2int   ACTIVE_CURSOR;
     3int   HAVE_BACKING;
     4int   DEBUG;
     5int   USE_XWINDOW;
     6int   MAP_WINDOW;
     7int   FOREGROUND;
    78char *NAME_WINDOW;
    89
  • trunk/Ohana/src/kapa2/include/prototypes.h

    r13331 r13333  
    5959int           DefineSection       PROTO(());
    6060int           SetFont             PROTO(());
    61 int           cursor              PROTO(());
    6261int           EraseCurrentPlot    PROTO(());
    6362int           ErasePlots          PROTO(());
  • trunk/Ohana/src/kapa2/src/CheckPipe.c

    r13331 r13333  
    3030 
    3131  /***** 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
    3241  if (!strcmp (buffer, "QUIT")) return (FALSE);
     42 
     43  if (!strcmp (buffer, "CURS")) {
     44    ACTIVE_CURSOR = TRUE;
     45    return (TRUE);
     46  }
    3347 
    3448  if (!strcmp (buffer, "PSIT")) {
     
    105119  }
    106120 
    107   // XXX replace this with the "ActiveCursor" boolean?
    108   if (!strcmp (buffer, "CURS")) {
    109     cursor ();
    110     return (TRUE);
    111   }
    112  
    113121  /* Erase Section */
    114122  if (!strcmp (buffer, "ERSC")) {
  • trunk/Ohana/src/kapa2/src/InterpretKeys.c

    r13320 r13333  
    11# include "Ximage.h"
    22
    3 int InterpretKeys (Graphic *graphic, XEvent *event) {
     3int InterpretKeys (Graphic *graphic, XKeyEvent *event) {
    44
    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;
    1211  KapaImageWidget *image;
     12  KapaGraphWidget *graph;
    1313
    1414  // XXX select the window element which contains the event
    1515  section = GetActiveSection();
    1616  image   = section->image;
     17  graph   = section->graph;
    1718
    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;
    2121
     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
     60skip_cursor:
    2261  // offset is in image pixels:
    2362  // 0.5 image pixels is 1 screen pixel for expand == +2
     
    4281    case XK_KP_Begin:
    4382    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);
    4584      X = 0.5*image[0].matrix.Naxis[0] - X;
    4685      Y = 0.5*image[0].matrix.Naxis[1] - Y;
  • trunk/Ohana/src/kapa2/src/InterpretPresses.c

    r13320 r13333  
    33int InterpretPresses (Graphic *graphic, XButtonEvent *event) {
    44
    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;
    911  KapaImageWidget *image;
     12  KapaGraphWidget *graph;
    1013
    1114  // XXX select the window element which contains the event
    1215  section = GetActiveSection();
    1316  image   = section->image;
     17  graph   = section->graph;
    1418
     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
     39skip_cursor:
    1540  status = TRUE;
    1641  this_button = event[0].button;
  • trunk/Ohana/src/kapa2/src/Layout.c

    r13320 r13333  
    2121    sock = KiiWait (argv[1]);
    2222  }
     23
     24  ACTIVE_CURSOR = FALSE;
    2325
    2426  /* get the display colors */
Note: See TracChangeset for help on using the changeset viewer.