From af269cb12600825b84ed061d9d7ef45dd367e155 Mon Sep 17 00:00:00 2001 From: joye Date: Wed, 4 Sep 2013 20:46:48 +0000 Subject: *** empty log message *** --- library/graph.tcl | 8 +- src/bltGrBind.C | 1027 --------------------------------------------- src/bltGrElemLineSpline.C | 141 ------- 3 files changed, 4 insertions(+), 1172 deletions(-) diff --git a/library/graph.tcl b/library/graph.tcl index 8c4fd8d..93988d3 100644 --- a/library/graph.tcl +++ b/library/graph.tcl @@ -524,9 +524,9 @@ proc blt::ZoomStack::Pop { g } { set _private($g,stack) [lrange $zoomStack 1 end] eval $cmd TitleLast $g - blt::busy hold $g +# blt::busy hold $g update - blt::busy release $g +# blt::busy release $g after 2000 [list blt::ZoomStack::DestroyTitle $g] } else { catch { $g marker delete "zoomTitle" } @@ -593,9 +593,9 @@ proc blt::ZoomStack::Push { g } { return } } - blt::busy hold $g +# blt::busy hold $g update; # This "update" redraws the graph - blt::busy release $g +# blt::busy release $g } proc blt::ZoomStack::SetAxisRanges { g axis min max } { diff --git a/src/bltGrBind.C b/src/bltGrBind.C index d4d189c..fbdbc22 100644 --- a/src/bltGrBind.C +++ b/src/bltGrBind.C @@ -34,9 +34,6 @@ static Tk_EventProc BindProc; typedef struct _Blt_BindTable BindTable; -/* Make button presses on objects have implicit grab. */ -#define FULLY_SIMULATE_GRAB 1 - /* * Binding table procedures. */ @@ -748,41 +745,6 @@ typedef struct { #define META_MASK (AnyModifier<<1) #define ALT_MASK (AnyModifier<<2) -static EventModifier eventModifiers[] = { - {"Alt", ALT_MASK, 0}, - {"Any", 0, 0}, /* Ignored: historical relic. */ - {"B1", Button1Mask, 0}, - {"B2", Button2Mask, 0}, - {"B3", Button3Mask, 0}, - {"B4", Button4Mask, 0}, - {"B5", Button5Mask, 0}, - {"Button1", Button1Mask, 0}, - {"Button2", Button2Mask, 0}, - {"Button3", Button3Mask, 0}, - {"Button4", Button4Mask, 0}, - {"Button5", Button5Mask, 0}, - {"Command", Mod1Mask, 0}, - {"Control", ControlMask, 0}, - {"Double", 0, DOUBLE}, - {"Lock", LockMask, 0}, - {"M", META_MASK, 0}, - {"M1", Mod1Mask, 0}, - {"M2", Mod2Mask, 0}, - {"M3", Mod3Mask, 0}, - {"M4", Mod4Mask, 0}, - {"M5", Mod5Mask, 0}, - {"Meta", META_MASK, 0}, - {"Mod1", Mod1Mask, 0}, - {"Mod2", Mod2Mask, 0}, - {"Mod3", Mod3Mask, 0}, - {"Mod4", Mod4Mask, 0}, - {"Mod5", Mod5Mask, 0}, - {"Option", Mod2Mask, 0}, - {"Quadruple", 0, QUADRUPLE}, - {"Shift", ShiftMask, 0}, - {"Triple", 0, TRIPLE}, -}; - typedef struct { const char *name; /* Name of event. */ int type; /* Event type for X, such as @@ -799,39 +761,6 @@ typedef struct { * asked about button events. */ -static EventInfo events[] = { - {"Activate", ActivateNotify, ActivateMask}, - {"Button", ButtonPress, ButtonPressMask}, - {"ButtonPress", ButtonPress, ButtonPressMask}, - {"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask}, - {"Circulate", CirculateNotify, StructureNotifyMask}, - {"CirculateRequest", CirculateRequest, SubstructureRedirectMask}, - {"Colormap", ColormapNotify, ColormapChangeMask}, - {"Configure", ConfigureNotify, StructureNotifyMask}, - {"ConfigureRequest", ConfigureRequest, SubstructureRedirectMask}, - {"Create", CreateNotify, SubstructureNotifyMask}, - {"Deactivate", DeactivateNotify, ActivateMask}, - {"Destroy", DestroyNotify, StructureNotifyMask}, - {"Enter", EnterNotify, EnterWindowMask}, - {"Expose", Expose, ExposureMask}, - {"FocusIn", FocusIn, FocusChangeMask}, - {"FocusOut", FocusOut, FocusChangeMask}, - {"Gravity", GravityNotify, StructureNotifyMask}, - {"Key", KeyPress, KeyPressMask}, - {"KeyPress", KeyPress, KeyPressMask}, - {"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask}, - {"Leave", LeaveNotify, LeaveWindowMask}, - {"Map", MapNotify, StructureNotifyMask}, - {"MapRequest", MapRequest, SubstructureRedirectMask}, - {"Motion", MotionNotify, ButtonPressMask|PointerMotionMask}, - {"MouseWheel", MouseWheelEvent, MouseWheelMask}, - {"Property", PropertyNotify, PropertyChangeMask}, - {"Reparent", ReparentNotify, StructureNotifyMask}, - {"ResizeRequest", ResizeRequest, ResizeRedirectMask}, - {"Unmap", UnmapNotify, StructureNotifyMask}, - {"Visibility", VisibilityNotify, VisibilityChangeMask}, -}; - /* * The defines and table below are used to classify events into * various groups. The reason for this is that logically identical @@ -867,960 +796,4 @@ static EventInfo events[] = { #define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL) #define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|CROSSING|VIRTUAL) -static int flagArray[TK_LASTEVENT+1] = { - /* Not used */ 0, - /* Not used */ 0, - /* KeyPress */ KEY, - /* KeyRelease */ KEY, - /* ButtonPress */ BUTTON, - /* ButtonRelease */ BUTTON, - /* MotionNotify */ MOTION, - /* EnterNotify */ CROSSING, - /* LeaveNotify */ CROSSING, - /* FocusIn */ FOCUS, - /* FocusOut */ FOCUS, - /* KeymapNotify */ 0, - /* Expose */ EXPOSE, - /* GraphicsExpose */ EXPOSE, - /* NoExpose */ 0, - /* VisibilityNotify */ VISIBILITY, - /* CreateNotify */ CREATE, - /* DestroyNotify */ DESTROY, - /* UnmapNotify */ UNMAP, - /* MapNotify */ MAP, - /* MapRequest */ MAPREQ, - /* ReparentNotify */ REPARENT, - /* ConfigureNotify */ CONFIG, - /* ConfigureRequest */ CONFIGREQ, - /* GravityNotify */ GRAVITY, - /* ResizeRequest */ RESIZEREQ, - /* CirculateNotify */ CIRC, - /* CirculateRequest */ 0, - /* PropertyNotify */ PROP, - /* SelectionClear */ 0, - /* SelectionRequest */ 0, - /* SelectionNotify */ 0, - /* ColormapNotify */ COLORMAP, - /* ClientMessage */ 0, - /* MappingNotify */ 0, -#ifdef GenericEvent - /* GenericEvent */ 0, -#endif - /* VirtualEvent */ VIRTUAL, - /* Activate */ ACTIVATE, - /* Deactivate */ ACTIVATE, - /* MouseWheel */ KEY -}; - -static EventModifier * -FindModifier(const char *string) -{ - int high, low; - char c; - - low = 0; - high = (sizeof(eventModifiers) / sizeof(EventModifier)) - 1; - c = string[0]; - while (low <= high) { - EventModifier *modPtr; - int compare; - int median; - - median = (low + high) >> 1; - modPtr = eventModifiers + median; - - /* Test the first character */ - compare = c - modPtr->name[0]; - if (compare == 0) { - compare = strcmp(string, modPtr->name); - } - if (compare < 0) { - high = median - 1; - } else if (compare > 0) { - low = median + 1; - } else { - return modPtr; /* Modifier found. */ - } - } - return NULL; /* Can't find modifier */ -} - -static EventInfo * -FindEvent(const char *string) -{ - int high, low; - char c; - - low = 0; - high = (sizeof(events) / sizeof(EventInfo)) - 1; - c = string[0]; - while (low <= high) { - EventInfo *infoPtr; - int compare; - int median; - - median = (low + high) >> 1; - infoPtr = events + median; - - /* Test the first character */ - compare = c - infoPtr->name[0]; - if (compare == 0) { - compare = strcmp(string, infoPtr->name); - } - if (compare < 0) { - high = median - 1; - } else if (compare > 0) { - low = median + 1; - } else { - return infoPtr; /* Event found. */ - } - } - return NULL; /* Can't find event. */ -} - - -/* - *---------------------------------------------------------------------- - * - * GetField -- - * - * Used to parse pattern descriptions. Copies up to - * size characters from p to copy, stopping at end of - * string, space, "-", ">", or whenever size is - * exceeded. - * - * Results: - * The return value is a pointer to the character just - * after the last one copied (usually "-" or space or - * ">", but could be anything if size was exceeded). - * Also places NULL-terminated string (up to size - * character, including NULL), at copy. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -static char * -GetField(p, copy, size) - char *p; /* Pointer to part of pattern. */ - char *copy; /* Place to copy field. */ - int size; /* Maximum number of characters to - * copy. */ -{ - while ((*p != '\0') && !isspace(UCHAR(*p)) && (*p != '>') - && (*p != '-') && (size > 1)) { - *copy = *p; - p++; - copy++; - size--; - } - *copy = '\0'; - return p; -} - -static int -ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, - Pattern *patPtr, unsigned long *eventMaskPtr) -{ - char *p; - unsigned long eventMask; - int count, eventFlags; -#define FIELD_SIZE 48 - char field[FIELD_SIZE]; - EventInfo *infoPtr; - - Tcl_DString copy; - Tcl_DStringInit(©); - p = Tcl_DStringAppend(©, *eventStringPtr, -1); - - patPtr->eventType = -1; - patPtr->needMods = 0; - patPtr->detail.clientData = 0; - - eventMask = 0; - count = 1; - - /* - * Handle simple ASCII characters. - */ - - if (*p != '<') { - char string[2]; - - patPtr->eventType = KeyPress; - eventMask = KeyPressMask; - string[0] = *p; - string[1] = 0; - patPtr->detail.keySym = XStringToKeysym(string); - if (patPtr->detail.keySym == NoSymbol) { - if (isprint(UCHAR(*p))) { - patPtr->detail.keySym = *p; - } else { - char buf[64]; - - sprintf(buf, "bad ASCII character 0x%x", (unsigned char) *p); - Tcl_SetResult(interp, buf, TCL_VOLATILE); - count = 0; - goto done; - } - } - p++; - goto end; - } - - /* - * A physical event description consists of: - * - * 1. open angle bracket. - * 2. any number of modifiers, each followed by spaces - * or dashes. - * 3. an optional event name. - * 4. an option button or keysym name. Either this or - * item 3 *must* be present; if both are present - * then they are separated by spaces or dashes. - * 5. a close angle bracket. - */ - - p++; - - while (1) { - EventModifier *modPtr; - p = GetField(p, field, FIELD_SIZE); - if (*p == '>') { - /* - * This solves the problem of, e.g., being - * misinterpreted as Control + Meta + missing keysym - * instead of Control + KeyPress + M. - */ - break; - } - modPtr = FindModifier(field); - if (modPtr == NULL) { - break; - } - patPtr->needMods |= modPtr->mask; - if (modPtr->flags & (MULT_CLICKS)) { - int i = modPtr->flags & MULT_CLICKS; - count = 2; - while (i >>= 1) count++; - } - while ((*p == '-') || isspace(UCHAR(*p))) { - p++; - } - } - - eventFlags = 0; - infoPtr = FindEvent(field); - if (infoPtr != NULL) { - patPtr->eventType = infoPtr->type; - eventFlags = flagArray[infoPtr->type]; - eventMask = infoPtr->eventMask; - while ((*p == '-') || isspace(UCHAR(*p))) { - p++; - } - p = GetField(p, field, FIELD_SIZE); - } - if (*field != '\0') { - if ((*field >= '1') && (*field <= '5') && (field[1] == '\0')) { - if (eventFlags == 0) { - patPtr->eventType = ButtonPress; - eventMask = ButtonPressMask; - } else if (eventFlags & KEY) { - goto getKeysym; - } else if ((eventFlags & BUTTON) == 0) { - Tcl_AppendResult(interp, "specified button \"", field, - "\" for non-button event", (char *) NULL); - count = 0; - goto done; - } - patPtr->detail.button = (*field - '0'); - } else { - getKeysym: - patPtr->detail.keySym = XStringToKeysym(field); - if (patPtr->detail.keySym == NoSymbol) { - Tcl_AppendResult(interp, "bad event type or keysym \"", - field, "\"", (char *)NULL); - count = 0; - goto done; - } - if (eventFlags == 0) { - patPtr->eventType = KeyPress; - eventMask = KeyPressMask; - } else if ((eventFlags & KEY) == 0) { - Tcl_AppendResult(interp, "specified keysym \"", field, - "\" for non-key event", (char *)NULL); - count = 0; - goto done; - } - } - } else if (eventFlags == 0) { - Tcl_AppendResult(interp, "no event type or button # or keysym", - (char *)NULL); - count = 0; - goto done; - } - - while ((*p == '-') || isspace(UCHAR(*p))) { - p++; - } - if (*p != '>') { - while (*p != '\0') { - p++; - if (*p == '>') { - Tcl_AppendResult(interp, - "extra characters after detail in binding", - (char *)NULL); - count = 0; - goto done; - } - } - Tcl_AppendResult(interp, "missing \">\" in binding", (char *)NULL); - count = 0; - goto done; - } - p++; - -end: - *eventStringPtr += (p - Tcl_DStringValue(©)); - *eventMaskPtr |= eventMask; -done: - Tcl_DStringFree(©); - return count; -} - -typedef struct { - int numKey; /* Integer representation of a value. */ - const char *strKey; /* String representation of a value. */ -} TkStateMap; - -static TkStateMap notifyMode[] = { - {NotifyNormal, "NotifyNormal"}, - {NotifyGrab, "NotifyGrab"}, - {NotifyUngrab, "NotifyUngrab"}, - {NotifyWhileGrabbed, "NotifyWhileGrabbed"}, - {-1, NULL} -}; - -static TkStateMap notifyDetail[] = { - {NotifyAncestor, "NotifyAncestor"}, - {NotifyVirtual, "NotifyVirtual"}, - {NotifyInferior, "NotifyInferior"}, - {NotifyNonlinear, "NotifyNonlinear"}, - {NotifyNonlinearVirtual, "NotifyNonlinearVirtual"}, - {NotifyPointer, "NotifyPointer"}, - {NotifyPointerRoot, "NotifyPointerRoot"}, - {NotifyDetailNone, "NotifyDetailNone"}, - {-1, NULL} -}; - -static TkStateMap circPlace[] = { - {PlaceOnTop, "PlaceOnTop"}, - {PlaceOnBottom, "PlaceOnBottom"}, - {-1, NULL} -}; - -static TkStateMap visNotify[] = { - {VisibilityUnobscured, "VisibilityUnobscured"}, - {VisibilityPartiallyObscured, "VisibilityPartiallyObscured"}, - {VisibilityFullyObscured, "VisibilityFullyObscured"}, - {-1, NULL} -}; - -static TkStateMap configureRequestDetail[] = { - {None, "None"}, - {Above, "Above"}, - {Below, "Below"}, - {BottomIf, "BottomIf"}, - {TopIf, "TopIf"}, - {Opposite, "Opposite"}, - {-1, NULL} -}; - -static TkStateMap propNotify[] = { - {PropertyNewValue, "NewValue"}, - {PropertyDelete, "Delete"}, - {-1, NULL} -}; - -/* - *--------------------------------------------------------------------------- - * - * HandleEventGenerate -- - * - * Helper function for the "event generate" command. Generate and - * process an XEvent, constructed from information parsed from the - * event description string and its optional arguments. - * - * argv[0] contains name of the target window. - * argv[1] contains pattern string for one event (e.g, ). - * argv[2..argc-1] contains -field/option pairs for specifying - * additional detail in the generated event. - * - * Either virtual or physical events can be generated this way. - * The event description string must contain the specification - * for only one event. - * - * Results: - * None. - * - * Side effects: - * When constructing the event, - * event.xany.serial is filled with the current X serial number. - * event.xany.window is filled with the target window. - * event.xany.display is filled with the target window's display. - * Any other fields in eventPtr which are not specified by the pattern - * string or the optional arguments, are set to 0. - * - * The event may be handled sychronously or asynchronously, depending - * on the value specified by the optional "-when" option. The - * default setting is synchronous. - * - *--------------------------------------------------------------------------- - */ -static int -SendEventCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *const *objv) -{ - XEvent event; - CONST char *p; - char *name; - Window window; - Display *display; - Tk_Window tkwin; - int count, flags, synch, i, number, warp; - Tcl_QueuePosition pos; - Pattern pat; - unsigned long eventMask; - static CONST char *fieldStrings[] = { - "-when", "-above", "-borderwidth", "-button", - "-count", "-delta", "-detail", "-focus", - "-height", - "-keycode", "-keysym", "-mode", "-override", - "-place", "-root", "-rootx", "-rooty", - "-sendevent", "-serial", "-state", "-subwindow", - "-time", "-warp", "-width", "-window", - "-x", "-y", NULL - }; - enum field { - EVENT_WHEN, EVENT_ABOVE, EVENT_BORDER, EVENT_BUTTON, - EVENT_COUNT, EVENT_DELTA, EVENT_DETAIL, EVENT_FOCUS, - EVENT_HEIGHT, - EVENT_KEYCODE, EVENT_KEYSYM, EVENT_MODE, EVENT_OVERRIDE, - EVENT_PLACE, EVENT_ROOT, EVENT_ROOTX, EVENT_ROOTY, - EVENT_SEND, EVENT_SERIAL, EVENT_STATE, EVENT_SUBWINDOW, - EVENT_TIME, EVENT_WARP, EVENT_WIDTH, EVENT_WINDOW, - EVENT_X, EVENT_Y - }; - tkwin = Tk_MainWindow(interp); - if (Blt_GetWindowFromObj(interp, objv[1], &window) != TCL_OK) { - return TCL_ERROR; - } - name = Tcl_GetStringFromObj(objv[2], NULL); - - display = Tk_Display(tkwin); - p = name; - eventMask = 0; - count = ParseEventDescription(interp, &p, &pat, &eventMask); - if (count == 0) { - return TCL_ERROR; - } - if (count != 1) { - Tcl_AppendResult(interp, "Double or Triple modifier not allowed", - (char *)NULL); - return TCL_ERROR; - } - if (*p != '\0') { - Tcl_AppendResult(interp, "only one event specification allowed", - (char *)NULL); - return TCL_ERROR; - } - - memset((VOID *) &event, 0, sizeof(event)); - event.xany.type = pat.eventType; - event.xany.serial = NextRequest(display); - event.xany.send_event = False; - event.xany.window = window; - event.xany.display = display; - - flags = flagArray[event.xany.type]; - if (flags & DESTROY) { - /* - * Event DestroyNotify should be generated by destroying - * the window. - */ - XDestroyWindow(display, window); - return TCL_OK; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) { - event.xkey.state = pat.needMods; - if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) { - TkpSetKeycodeAndState(tkwin, pat.detail.keySym, &event); - } else if (flags & BUTTON) { - event.xbutton.button = pat.detail.button; - } else if (flags & VIRTUAL) { - ((XVirtualEvent *) &event)->name = pat.detail.name; - } - } - if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) { - event.xcreatewindow.window = event.xany.window; - } - - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.x_root = -1; - event.xkey.y_root = -1; - } - - /* - * Process the remaining arguments to fill in additional fields - * of the event. - */ - - synch = 1; - warp = 0; - pos = TCL_QUEUE_TAIL; - for (i = 3; i < objc; i += 2) { - Tcl_Obj *optionPtr, *valuePtr; - int index; - - optionPtr = objv[i]; - valuePtr = objv[i + 1]; - - if (Tcl_GetIndexFromObj(interp, optionPtr, fieldStrings, "option", - TCL_EXACT, &index) != TCL_OK) { - return TCL_ERROR; - } - if ((objc & 1) == 0) { - /* - * This test occurs after Tcl_GetIndexFromObj() so that - * "event generate