summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-03-13 22:32:39 (GMT)
committerjoye <joye>2014-03-13 22:32:39 (GMT)
commit29cc5181407d04f35425952d840373e62663f797 (patch)
treefe12e65ce86f542c23fde04908646b9bcac526a3
parent4415b9fca5a03d8ae7f4a67bdd109ad87d95bf7d (diff)
downloadblt-29cc5181407d04f35425952d840373e62663f797.zip
blt-29cc5181407d04f35425952d840373e62663f797.tar.gz
blt-29cc5181407d04f35425952d840373e62663f797.tar.bz2
*** empty log message ***
-rw-r--r--bltGrMarkerBitmap.C18
-rw-r--r--src/bltGrAxis.C5
-rw-r--r--src/bltGrBind.C995
-rw-r--r--src/bltGrMarker.C13
-rw-r--r--src/bltGrMarkerLine.C16
-rw-r--r--src/bltGrMarkerLine.h3
-rw-r--r--src/bltGrMarkerPolygon.C2
-rw-r--r--src/bltGrMarkerPolygon.h2
-rw-r--r--src/bltGrMarkerText.C13
-rw-r--r--src/bltGraph.h2
10 files changed, 514 insertions, 555 deletions
diff --git a/bltGrMarkerBitmap.C b/bltGrMarkerBitmap.C
index 74b544c..bc5da82 100644
--- a/bltGrMarkerBitmap.C
+++ b/bltGrMarkerBitmap.C
@@ -123,12 +123,12 @@ static int ConfigureBitmapProc(Marker *markerPtr)
}
gcMask = 0;
- if (bmPtr->outlineColor != NULL) {
+ if (bmPtr->outlineColor) {
gcMask |= GCForeground;
gcValues.foreground = bmPtr->outlineColor->pixel;
}
- if (bmPtr->fillColor != NULL) {
+ if (bmPtr->fillColor) {
/* Opaque bitmap: both foreground and background (fill) colors
* are used. */
gcValues.background = bmPtr->fillColor->pixel;
@@ -146,17 +146,17 @@ static int ConfigureBitmapProc(Marker *markerPtr)
* this particular bitmap.
*/
newGC = Tk_GetGC(graphPtr->tkwin, gcMask, &gcValues);
- if (bmPtr->gc != NULL) {
+ if (bmPtr->gc) {
Tk_FreeGC(graphPtr->display, bmPtr->gc);
}
bmPtr->gc = newGC;
/* Create the background GC containing the fill color. */
- if (bmPtr->fillColor != NULL) {
+ if (bmPtr->fillColor) {
gcValues.foreground = bmPtr->fillColor->pixel;
newGC = Tk_GetGC(graphPtr->tkwin, gcMask, &gcValues);
- if (bmPtr->fillGC != NULL) {
+ if (bmPtr->fillGC) {
Tk_FreeGC(graphPtr->display, bmPtr->fillGC);
}
bmPtr->fillGC = newGC;
@@ -400,7 +400,7 @@ static void DrawBitmapProc(Marker *markerPtr, Drawable drawable)
* If the bitmap is rotated and a filled background is required, then
* a filled polygon is drawn before the bitmap.
*/
- if (bmPtr->fillColor != NULL) {
+ if (bmPtr->fillColor) {
int i;
XPoint polygon[MAX_OUTLINE_POINTS];
@@ -433,7 +433,7 @@ static void BitmapToPostscriptProc(Marker *markerPtr, Blt_Ps ps)
if ((bitmap == None) || (bmPtr->destWidth < 1) || (bmPtr->destHeight < 1)) {
return; /* No bitmap to display. */
}
- if (bmPtr->fillColor != NULL) {
+ if (bmPtr->fillColor) {
Blt_Ps_XSetBackground(ps, bmPtr->fillColor);
Blt_Ps_XFillPolygon(ps, bmPtr->outline, 4);
}
@@ -458,10 +458,10 @@ static void FreeBitmapProc(Marker *markerPtr)
BitmapMarker *bmPtr = (BitmapMarker *)markerPtr;
Graph* graphPtr = markerPtr->obj.graphPtr;
- if (bmPtr->gc != NULL) {
+ if (bmPtr->gc) {
Tk_FreeGC(graphPtr->display, bmPtr->gc);
}
- if (bmPtr->fillGC != NULL) {
+ if (bmPtr->fillGC) {
Tk_FreeGC(graphPtr->display, bmPtr->fillGC);
}
if (bmPtr->destBitmap != None) {
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 1a8fe28..49a8dce 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -89,7 +89,6 @@ static int AxisIsHorizontal(Axis *axisPtr);
static void FreeTickLabels(Blt_Chain chain);
static int ConfigureAxis(Axis *axisPtr);
static Axis *NewAxis(Graph* graphPtr, const char *name, int margin);
-static void ReleaseAxis(Axis *axisPtr);
static int GetAxisByClass(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr,
ClassId classId, Axis **axisPtrPtr);
static void DestroyAxis(Axis *axisPtr);
@@ -125,7 +124,7 @@ static int AxisSetProc(ClientData clientData, Tcl_Interp* interp,
if (GetAxisByClass(interp, graphPtr, *objPtr, classId, &axisPtr) != TCL_OK)
return TCL_ERROR;
- ReleaseAxis(*axisPtrPtr);
+ Blt_ReleaseAxis(*axisPtrPtr);
*axisPtrPtr = axisPtr;
return TCL_OK;
@@ -1306,7 +1305,7 @@ static int AxisIsHorizontal(Axis *axisPtr)
return ((axisPtr->obj.classId == CID_AXIS_Y) == graphPtr->inverted);
}
-static void ReleaseAxis(Axis *axisPtr)
+void Blt_ReleaseAxis(Axis *axisPtr)
{
if (axisPtr) {
axisPtr->refCount--;
diff --git a/src/bltGrBind.C b/src/bltGrBind.C
index 44eee4e..a78dd1c 100644
--- a/src/bltGrBind.C
+++ b/src/bltGrBind.C
@@ -40,25 +40,25 @@ typedef struct _Blt_BindTable BindTable;
#define REPICK_IN_PROGRESS (1<<0)
#define LEFT_GRABBED_ITEM (1<<1)
-#define ALL_BUTTONS_MASK \
- (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)
+#define ALL_BUTTONS_MASK \
+ (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)
#ifndef VirtualEventMask
#define VirtualEventMask (1L << 30)
#endif
-#define ALL_VALID_EVENTS_MASK \
- (ButtonMotionMask | Button1MotionMask | Button2MotionMask | \
- Button3MotionMask | Button4MotionMask | Button5MotionMask | \
- ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \
- LeaveWindowMask | KeyPressMask | KeyReleaseMask | \
- PointerMotionMask | VirtualEventMask)
+#define ALL_VALID_EVENTS_MASK \
+ (ButtonMotionMask | Button1MotionMask | Button2MotionMask | \
+ Button3MotionMask | Button4MotionMask | Button5MotionMask | \
+ ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \
+ LeaveWindowMask | KeyPressMask | KeyReleaseMask | \
+ PointerMotionMask | VirtualEventMask)
-static int buttonMasks[] =
-{
- 0, /* No buttons pressed */
- Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask,
-};
+ static int buttonMasks[] =
+ {
+ 0, /* No buttons pressed */
+ Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask,
+ };
/*
@@ -91,60 +91,60 @@ static int buttonMasks[] =
*/
static void
DoEvent(
- BindTable *bindPtr, /* Binding information for widget in which
- * event occurred. */
- XEvent *eventPtr, /* Real or simulated X event that is to be
- * processed. */
- ClientData item, /* Item picked. */
- ClientData context) /* Context of item. */
+ BindTable *bindPtr, /* Binding information for widget in which
+ * event occurred. */
+ XEvent *eventPtr, /* Real or simulated X event that is to be
+ * processed. */
+ ClientData item, /* Item picked. */
+ ClientData context) /* Context of item. */
{
- Blt_List tagList;
-
- if ((bindPtr->tkwin == NULL) || (bindPtr->bindingTable == NULL)) {
- return;
- }
- if ((eventPtr->type == KeyPress) || (eventPtr->type == KeyRelease)) {
- item = bindPtr->focusItem;
- context = bindPtr->focusContext;
- }
- if (item == NULL) {
- return;
- }
- /*
- * Invoke the binding system.
- */
- tagList = Blt_List_Create(BLT_ONE_WORD_KEYS);
- if (bindPtr->tagProc == NULL) {
- Blt_List_Append(tagList, Tk_GetUid("all"), 0);
- Blt_List_Append(tagList, (char *)item, 0);
- } else {
- (*bindPtr->tagProc) (bindPtr, item, context, tagList);
- }
- if (Blt_List_GetLength(tagList) > 0) {
- int nTags;
- ClientData *tagArray;
+ Blt_List tagList;
+
+ if ((bindPtr->tkwin == NULL) || (bindPtr->bindingTable == NULL)) {
+ return;
+ }
+ if ((eventPtr->type == KeyPress) || (eventPtr->type == KeyRelease)) {
+ item = bindPtr->focusItem;
+ context = bindPtr->focusContext;
+ }
+ if (item == NULL) {
+ return;
+ }
+ /*
+ * Invoke the binding system.
+ */
+ tagList = Blt_List_Create(BLT_ONE_WORD_KEYS);
+ if (bindPtr->tagProc == NULL) {
+ Blt_List_Append(tagList, Tk_GetUid("all"), 0);
+ Blt_List_Append(tagList, (char *)item, 0);
+ } else {
+ (*bindPtr->tagProc) (bindPtr, item, context, tagList);
+ }
+ if (Blt_List_GetLength(tagList) > 0) {
+ int nTags;
+ ClientData *tagArray;
#define MAX_STATIC_TAGS 64
- ClientData staticTags[MAX_STATIC_TAGS];
- Blt_ListNode node;
+ ClientData staticTags[MAX_STATIC_TAGS];
+ Blt_ListNode node;
- tagArray = staticTags;
- nTags = Blt_List_GetLength(tagList);
- if (nTags >= MAX_STATIC_TAGS) {
- tagArray = malloc(sizeof(ClientData) * nTags);
+ tagArray = staticTags;
+ nTags = Blt_List_GetLength(tagList);
+ if (nTags >= MAX_STATIC_TAGS) {
+ tagArray = malloc(sizeof(ClientData) * nTags);
- }
- nTags = 0;
- for (node = Blt_List_FirstNode(tagList); node != NULL;
- node = Blt_List_NextNode(node)) {
- tagArray[nTags++] = (ClientData)Blt_List_GetKey(node);
- }
- Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags,
- tagArray);
- if (tagArray != staticTags) {
- free(tagArray);
- }
+ }
+ nTags = 0;
+ for (node = Blt_List_FirstNode(tagList); node != NULL;
+ node = Blt_List_NextNode(node)) {
+ tagArray[nTags++] = (ClientData)Blt_List_GetKey(node);
}
- Blt_List_Destroy(tagList);
+ Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags,
+ tagArray);
+ if (tagArray != staticTags) {
+ free(tagArray);
+ }
+ }
+ Blt_List_Destroy(tagList);
}
/*
@@ -170,492 +170,459 @@ DoEvent(
*/
static void
PickCurrentItem(
- BindTable *bindPtr, /* Binding table information. */
- XEvent *eventPtr) /* Event describing location of mouse cursor.
- * Must be EnterWindow, LeaveWindow,
- * ButtonRelease, or MotionNotify. */
+ BindTable *bindPtr, /* Binding table information. */
+ XEvent *eventPtr) /* Event describing location of mouse cursor.
+ * Must be EnterWindow, LeaveWindow,
+ * ButtonRelease, or MotionNotify. */
{
- int buttonDown;
- ClientData newItem, oldItem;
- ClientData newContext;
-
- /*
- * Check whether or not a button is down. If so, we'll log entry and exit
- * into and out of the current item, but not entry into any other item.
- * This implements a form of grabbing equivalent to what the X server does
- * for windows.
- */
- buttonDown = (bindPtr->state & ALL_BUTTONS_MASK);
- if (!buttonDown) {
- bindPtr->flags &= ~LEFT_GRABBED_ITEM;
- }
-
- /*
- * Save information about this event in the widget. The event in the
- * widget is used for two purposes:
- *
- * 1. Event bindings: if the current item changes, fake events are
- * generated to allow item-enter and item-leave bindings to trigger.
- * 2. Reselection: if the current item gets deleted, can use the
- * saved event to find a new current item.
- * Translate MotionNotify events into EnterNotify events, since that's
- * what gets reported to item handlers.
- */
-
- if (eventPtr != &bindPtr->pickEvent) {
- if ((eventPtr->type == MotionNotify) ||
- (eventPtr->type == ButtonRelease)) {
- bindPtr->pickEvent.xcrossing.type = EnterNotify;
- bindPtr->pickEvent.xcrossing.serial = eventPtr->xmotion.serial;
- bindPtr->pickEvent.xcrossing.send_event =
- eventPtr->xmotion.send_event;
- bindPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display;
- bindPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window;
- bindPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root;
- bindPtr->pickEvent.xcrossing.subwindow = None;
- bindPtr->pickEvent.xcrossing.time = eventPtr->xmotion.time;
- bindPtr->pickEvent.xcrossing.x = eventPtr->xmotion.x;
- bindPtr->pickEvent.xcrossing.y = eventPtr->xmotion.y;
- bindPtr->pickEvent.xcrossing.x_root = eventPtr->xmotion.x_root;
- bindPtr->pickEvent.xcrossing.y_root = eventPtr->xmotion.y_root;
- bindPtr->pickEvent.xcrossing.mode = NotifyNormal;
- bindPtr->pickEvent.xcrossing.detail = NotifyNonlinear;
- bindPtr->pickEvent.xcrossing.same_screen
- = eventPtr->xmotion.same_screen;
- bindPtr->pickEvent.xcrossing.focus = False;
- bindPtr->pickEvent.xcrossing.state = eventPtr->xmotion.state;
- } else {
- bindPtr->pickEvent = *eventPtr;
- }
- }
- bindPtr->activePick = TRUE;
-
- /*
- * If this is a recursive call (there's already a partially completed call
- * pending on the stack; it's in the middle of processing a Leave event
- * handler for the old current item) then just return; the pending call
- * will do everything that's needed.
- */
- if (bindPtr->flags & REPICK_IN_PROGRESS) {
- return;
+ int buttonDown;
+ ClientData newItem, oldItem;
+ ClientData newContext;
+
+ /*
+ * Check whether or not a button is down. If so, we'll log entry and exit
+ * into and out of the current item, but not entry into any other item.
+ * This implements a form of grabbing equivalent to what the X server does
+ * for windows.
+ */
+ buttonDown = (bindPtr->state & ALL_BUTTONS_MASK);
+ if (!buttonDown) {
+ bindPtr->flags &= ~LEFT_GRABBED_ITEM;
+ }
+
+ /*
+ * Save information about this event in the widget. The event in the
+ * widget is used for two purposes:
+ *
+ * 1. Event bindings: if the current item changes, fake events are
+ * generated to allow item-enter and item-leave bindings to trigger.
+ * 2. Reselection: if the current item gets deleted, can use the
+ * saved event to find a new current item.
+ * Translate MotionNotify events into EnterNotify events, since that's
+ * what gets reported to item handlers.
+ */
+
+ if (eventPtr != &bindPtr->pickEvent) {
+ if ((eventPtr->type == MotionNotify) ||
+ (eventPtr->type == ButtonRelease)) {
+ bindPtr->pickEvent.xcrossing.type = EnterNotify;
+ bindPtr->pickEvent.xcrossing.serial = eventPtr->xmotion.serial;
+ bindPtr->pickEvent.xcrossing.send_event =
+ eventPtr->xmotion.send_event;
+ bindPtr->pickEvent.xcrossing.display = eventPtr->xmotion.display;
+ bindPtr->pickEvent.xcrossing.window = eventPtr->xmotion.window;
+ bindPtr->pickEvent.xcrossing.root = eventPtr->xmotion.root;
+ bindPtr->pickEvent.xcrossing.subwindow = None;
+ bindPtr->pickEvent.xcrossing.time = eventPtr->xmotion.time;
+ bindPtr->pickEvent.xcrossing.x = eventPtr->xmotion.x;
+ bindPtr->pickEvent.xcrossing.y = eventPtr->xmotion.y;
+ bindPtr->pickEvent.xcrossing.x_root = eventPtr->xmotion.x_root;
+ bindPtr->pickEvent.xcrossing.y_root = eventPtr->xmotion.y_root;
+ bindPtr->pickEvent.xcrossing.mode = NotifyNormal;
+ bindPtr->pickEvent.xcrossing.detail = NotifyNonlinear;
+ bindPtr->pickEvent.xcrossing.same_screen
+ = eventPtr->xmotion.same_screen;
+ bindPtr->pickEvent.xcrossing.focus = False;
+ bindPtr->pickEvent.xcrossing.state = eventPtr->xmotion.state;
+ } else {
+ bindPtr->pickEvent = *eventPtr;
}
+ }
+ bindPtr->activePick = TRUE;
+
+ /*
+ * If this is a recursive call (there's already a partially completed call
+ * pending on the stack; it's in the middle of processing a Leave event
+ * handler for the old current item) then just return; the pending call
+ * will do everything that's needed.
+ */
+ if (bindPtr->flags & REPICK_IN_PROGRESS) {
+ return;
+ }
+ /*
+ * A LeaveNotify event automatically means that there's no current item,
+ * so the check for closest item can be skipped.
+ */
+ newContext = NULL;
+ if (bindPtr->pickEvent.type != LeaveNotify) {
+ int x, y;
+
+ x = bindPtr->pickEvent.xcrossing.x;
+ y = bindPtr->pickEvent.xcrossing.y;
+ newItem = (*bindPtr->pickProc) (bindPtr->clientData, x, y, &newContext);
+ } else {
+ newItem = NULL;
+ }
+ if (((newItem == bindPtr->currentItem) &&
+ (newContext == bindPtr->currentContext)) &&
+ ((bindPtr->flags & LEFT_GRABBED_ITEM) == 0)) {
/*
- * A LeaveNotify event automatically means that there's no current item,
- * so the check for closest item can be skipped.
+ * Nothing to do: the current item hasn't changed.
*/
- newContext = NULL;
- if (bindPtr->pickEvent.type != LeaveNotify) {
- int x, y;
-
- x = bindPtr->pickEvent.xcrossing.x;
- y = bindPtr->pickEvent.xcrossing.y;
- newItem = (*bindPtr->pickProc) (bindPtr->clientData, x, y, &newContext);
- } else {
- newItem = NULL;
- }
- if (((newItem == bindPtr->currentItem) &&
- (newContext == bindPtr->currentContext)) &&
- ((bindPtr->flags & LEFT_GRABBED_ITEM) == 0)) {
- /*
- * Nothing to do: the current item hasn't changed.
- */
- return;
- }
+ return;
+ }
+ /*
+ * Simulate a LeaveNotify event on the previous current item and an
+ * EnterNotify event on the new current item. Remove the "current" tag
+ * from the previous current item and place it on the new current item.
+ */
+ oldItem = bindPtr->currentItem;
+ Tcl_Preserve(oldItem);
+ Tcl_Preserve(newItem);
+
+ if ((bindPtr->currentItem != NULL) &&
+ ((newItem != bindPtr->currentItem) ||
+ (newContext != bindPtr->currentContext)) &&
+ ((bindPtr->flags & LEFT_GRABBED_ITEM) == 0)) {
+ XEvent event;
+
+ event = bindPtr->pickEvent;
+ event.type = LeaveNotify;
/*
- * Simulate a LeaveNotify event on the previous current item and an
- * EnterNotify event on the new current item. Remove the "current" tag
- * from the previous current item and place it on the new current item.
+ * If the event's detail happens to be NotifyInferior the binding
+ * mechanism will discard the event. To be consistent, always use
+ * NotifyAncestor.
*/
- oldItem = bindPtr->currentItem;
- Tcl_Preserve(oldItem);
- Tcl_Preserve(newItem);
+ event.xcrossing.detail = NotifyAncestor;
- if ((bindPtr->currentItem != NULL) &&
- ((newItem != bindPtr->currentItem) ||
- (newContext != bindPtr->currentContext)) &&
- ((bindPtr->flags & LEFT_GRABBED_ITEM) == 0)) {
- XEvent event;
+ bindPtr->flags |= REPICK_IN_PROGRESS;
+ DoEvent(bindPtr, &event, bindPtr->currentItem, bindPtr->currentContext);
+ bindPtr->flags &= ~REPICK_IN_PROGRESS;
- event = bindPtr->pickEvent;
- event.type = LeaveNotify;
- /*
- * If the event's detail happens to be NotifyInferior the binding
- * mechanism will discard the event. To be consistent, always use
- * NotifyAncestor.
- */
- event.xcrossing.detail = NotifyAncestor;
-
- bindPtr->flags |= REPICK_IN_PROGRESS;
- DoEvent(bindPtr, &event, bindPtr->currentItem, bindPtr->currentContext);
- bindPtr->flags &= ~REPICK_IN_PROGRESS;
-
- /*
- * Note: during DoEvent above, it's possible that bindPtr->newItem got
- * reset to NULL because the item was deleted.
- */
- }
- if (((newItem != bindPtr->currentItem) ||
- (newContext != bindPtr->currentContext)) &&
- (buttonDown)) {
- XEvent event;
-
- bindPtr->flags |= LEFT_GRABBED_ITEM;
- event = bindPtr->pickEvent;
- if ((newItem != bindPtr->newItem) ||
- (newContext != bindPtr->newContext)) {
- ClientData savedItem;
- ClientData savedContext;
-
- /*
- * Generate <Enter> and <Leave> events for objects during button
- * grabs. This isn't standard. But for example, it allows one to
- * provide balloon help on the individual entries of the Hierbox
- * widget.
- */
- savedItem = bindPtr->currentItem;
- savedContext = bindPtr->currentContext;
- if (bindPtr->newItem != NULL) {
- event.type = LeaveNotify;
- event.xcrossing.detail = NotifyVirtual /* Ancestor */ ;
- bindPtr->currentItem = bindPtr->newItem;
- DoEvent(bindPtr, &event, bindPtr->newItem, bindPtr->newContext);
- }
- bindPtr->newItem = newItem;
- bindPtr->newContext = newContext;
- if (newItem != NULL) {
- event.type = EnterNotify;
- event.xcrossing.detail = NotifyVirtual /* Ancestor */ ;
- bindPtr->currentItem = newItem;
- DoEvent(bindPtr, &event, newItem, newContext);
- }
- bindPtr->currentItem = savedItem;
- bindPtr->currentContext = savedContext;
- }
- goto done;
- }
/*
- * Special note: it's possible that
- * bindPtr->newItem == bindPtr->currentItem
- * here. This can happen, for example, if LEFT_GRABBED_ITEM was set.
+ * Note: during DoEvent above, it's possible that bindPtr->newItem got
+ * reset to NULL because the item was deleted.
*/
-
- bindPtr->flags &= ~LEFT_GRABBED_ITEM;
- bindPtr->currentItem = bindPtr->newItem = newItem;
- bindPtr->currentContext = bindPtr->newContext = newContext;
- if (bindPtr->currentItem != NULL) {
- XEvent event;
-
- event = bindPtr->pickEvent;
+ }
+ if (((newItem != bindPtr->currentItem) ||
+ (newContext != bindPtr->currentContext)) &&
+ (buttonDown)) {
+ XEvent event;
+
+ bindPtr->flags |= LEFT_GRABBED_ITEM;
+ event = bindPtr->pickEvent;
+ if ((newItem != bindPtr->newItem) ||
+ (newContext != bindPtr->newContext)) {
+ ClientData savedItem;
+ ClientData savedContext;
+
+ /*
+ * Generate <Enter> and <Leave> events for objects during button
+ * grabs. This isn't standard. But for example, it allows one to
+ * provide balloon help on the individual entries of the Hierbox
+ * widget.
+ */
+ savedItem = bindPtr->currentItem;
+ savedContext = bindPtr->currentContext;
+ if (bindPtr->newItem != NULL) {
+ event.type = LeaveNotify;
+ event.xcrossing.detail = NotifyVirtual /* Ancestor */ ;
+ bindPtr->currentItem = bindPtr->newItem;
+ DoEvent(bindPtr, &event, bindPtr->newItem, bindPtr->newContext);
+ }
+ bindPtr->newItem = newItem;
+ bindPtr->newContext = newContext;
+ if (newItem != NULL) {
event.type = EnterNotify;
- event.xcrossing.detail = NotifyAncestor;
+ event.xcrossing.detail = NotifyVirtual /* Ancestor */ ;
+ bindPtr->currentItem = newItem;
DoEvent(bindPtr, &event, newItem, newContext);
+ }
+ bindPtr->currentItem = savedItem;
+ bindPtr->currentContext = savedContext;
}
+ goto done;
+ }
+ /*
+ * Special note: it's possible that
+ * bindPtr->newItem == bindPtr->currentItem
+ * here. This can happen, for example, if LEFT_GRABBED_ITEM was set.
+ */
+
+ bindPtr->flags &= ~LEFT_GRABBED_ITEM;
+ bindPtr->currentItem = bindPtr->newItem = newItem;
+ bindPtr->currentContext = bindPtr->newContext = newContext;
+ if (bindPtr->currentItem != NULL) {
+ XEvent event;
+
+ event = bindPtr->pickEvent;
+ event.type = EnterNotify;
+ event.xcrossing.detail = NotifyAncestor;
+ DoEvent(bindPtr, &event, newItem, newContext);
+ }
done:
- Tcl_Release(newItem);
- Tcl_Release(oldItem);
+ Tcl_Release(newItem);
+ Tcl_Release(oldItem);
}
-/*
- *---------------------------------------------------------------------------
- *
- * BindProc --
- *
- * This procedure is invoked by the Tk dispatcher to handle events
- * associated with bindings on items.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Depends on the command invoked as part of the binding
- * (if there was any).
- *
- *---------------------------------------------------------------------------
- */
-static void
-BindProc(
- ClientData clientData, /* Pointer to widget structure. */
- XEvent *eventPtr) /* Pointer to X event that just happened. */
+static void BindProc(ClientData clientData, XEvent *eventPtr)
{
- BindTable *bindPtr = clientData;
- int mask;
-
- Tcl_Preserve(bindPtr->clientData);
+ BindTable *bindPtr = clientData;
+ int mask;
+
+ Tcl_Preserve(bindPtr->clientData);
+ /*
+ * This code below keeps track of the current modifier state in
+ * bindPtr->state. This information is used to defer repicks of the
+ * current item while buttons are down.
+ */
+ switch (eventPtr->type) {
+ case ButtonPress:
+ case ButtonRelease:
+ mask = 0;
+ if ((eventPtr->xbutton.button >= Button1) &&
+ (eventPtr->xbutton.button <= Button5)) {
+ mask = buttonMasks[eventPtr->xbutton.button];
+ }
/*
- * This code below keeps track of the current modifier state in
- * bindPtr->state. This information is used to defer repicks of the
- * current item while buttons are down.
+ * For button press events, repick the current item using the button
+ * state before the event, then process the event. For button release
+ * events, first process the event, then repick the current item using
+ * the button state *after* the event (the button has logically gone
+ * up before we change the current item).
*/
- switch (eventPtr->type) {
- case ButtonPress:
- case ButtonRelease:
- mask = 0;
- if ((eventPtr->xbutton.button >= Button1) &&
- (eventPtr->xbutton.button <= Button5)) {
- mask = buttonMasks[eventPtr->xbutton.button];
- }
- /*
- * For button press events, repick the current item using the button
- * state before the event, then process the event. For button release
- * events, first process the event, then repick the current item using
- * the button state *after* the event (the button has logically gone
- * up before we change the current item).
- */
- if (eventPtr->type == ButtonPress) {
-
- /*
- * On a button press, first repick the current item using the
- * button state before the event, the process the event.
- */
-
- bindPtr->state = eventPtr->xbutton.state;
- PickCurrentItem(bindPtr, eventPtr);
- bindPtr->state ^= mask;
- DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
-
- } else {
-
- /*
- * Button release: first process the event, with the button still
- * considered to be down. Then repick the current item under the
- * assumption that the button is no longer down.
- */
- bindPtr->state = eventPtr->xbutton.state;
- DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
- eventPtr->xbutton.state ^= mask;
- bindPtr->state = eventPtr->xbutton.state;
- PickCurrentItem(bindPtr, eventPtr);
- eventPtr->xbutton.state ^= mask;
- }
- break;
-
- case EnterNotify:
- case LeaveNotify:
- bindPtr->state = eventPtr->xcrossing.state;
- PickCurrentItem(bindPtr, eventPtr);
- break;
-
- case MotionNotify:
- bindPtr->state = eventPtr->xmotion.state;
- PickCurrentItem(bindPtr, eventPtr);
- DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
- break;
-
- case KeyPress:
- case KeyRelease:
- bindPtr->state = eventPtr->xkey.state;
- PickCurrentItem(bindPtr, eventPtr);
- DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
- break;
- }
- Tcl_Release(bindPtr->clientData);
-}
+ if (eventPtr->type == ButtonPress) {
-int
-Blt_ConfigureBindings(
- Tcl_Interp* interp,
- BindTable *bindPtr,
- ClientData item,
- int argc,
- const char **argv)
-{
- const char *command;
- unsigned long mask;
- const char *seq;
+ /*
+ * On a button press, first repick the current item using the
+ * button state before the event, the process the event.
+ */
- if (argc == 0) {
- Tk_GetAllBindings(interp, bindPtr->bindingTable, item);
- return TCL_OK;
- }
- if (argc == 1) {
- command = Tk_GetBinding(interp, bindPtr->bindingTable, item, argv[0]);
- if (command == NULL) {
- Tcl_AppendResult(interp, "can't find event \"", argv[0], "\"",
- (char *)NULL);
- return TCL_ERROR;
- }
- Tcl_SetStringObj(Tcl_GetObjResult(interp), command, -1);
- return TCL_OK;
- }
+ bindPtr->state = eventPtr->xbutton.state;
+ PickCurrentItem(bindPtr, eventPtr);
+ bindPtr->state ^= mask;
+ DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
+ bindPtr->currentContext);
- seq = argv[0];
- command = argv[1];
+ } else {
- if (command[0] == '\0') {
- return Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
+ /*
+ * Button release: first process the event, with the button still
+ * considered to be down. Then repick the current item under the
+ * assumption that the button is no longer down.
+ */
+ bindPtr->state = eventPtr->xbutton.state;
+ DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
+ bindPtr->currentContext);
+ eventPtr->xbutton.state ^= mask;
+ bindPtr->state = eventPtr->xbutton.state;
+ PickCurrentItem(bindPtr, eventPtr);
+ eventPtr->xbutton.state ^= mask;
}
+ break;
+
+ case EnterNotify:
+ case LeaveNotify:
+ bindPtr->state = eventPtr->xcrossing.state;
+ PickCurrentItem(bindPtr, eventPtr);
+ break;
+
+ case MotionNotify:
+ bindPtr->state = eventPtr->xmotion.state;
+ PickCurrentItem(bindPtr, eventPtr);
+ DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
+ bindPtr->currentContext);
+ break;
+
+ case KeyPress:
+ case KeyRelease:
+ bindPtr->state = eventPtr->xkey.state;
+ PickCurrentItem(bindPtr, eventPtr);
+ DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
+ bindPtr->currentContext);
+ break;
+ }
+ Tcl_Release(bindPtr->clientData);
+}
- if (command[0] == '+') {
- mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
- command + 1, TRUE);
- } else {
- mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
- command, FALSE);
- }
- if (mask == 0) {
- Tcl_AppendResult(interp, "event mask can't be zero for \"", item, "\"",
- (char *)NULL);
- return TCL_ERROR;
- }
- if (mask & (unsigned)~ALL_VALID_EVENTS_MASK) {
- Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "requested illegal events; ",
- "only key, button, motion, enter, leave, and virtual ",
- "events may be used", (char *)NULL);
- return TCL_ERROR;
+int Blt_ConfigureBindings(
+ Tcl_Interp* interp,
+ BindTable *bindPtr,
+ ClientData item,
+ int argc,
+ const char **argv)
+{
+ const char *command;
+ unsigned long mask;
+ const char *seq;
+
+ if (argc == 0) {
+ Tk_GetAllBindings(interp, bindPtr->bindingTable, item);
+ return TCL_OK;
+ }
+ if (argc == 1) {
+ command = Tk_GetBinding(interp, bindPtr->bindingTable, item, argv[0]);
+ if (command == NULL) {
+ Tcl_AppendResult(interp, "can't find event \"", argv[0], "\"",
+ (char *)NULL);
+ return TCL_ERROR;
}
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), command, -1);
return TCL_OK;
+ }
+
+ seq = argv[0];
+ command = argv[1];
+
+ if (command[0] == '\0') {
+ return Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
+ }
+
+ if (command[0] == '+') {
+ mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
+ command + 1, TRUE);
+ } else {
+ mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
+ command, FALSE);
+ }
+ if (mask == 0) {
+ Tcl_AppendResult(interp, "event mask can't be zero for \"", item, "\"",
+ (char *)NULL);
+ return TCL_ERROR;
+ }
+ if (mask & (unsigned)~ALL_VALID_EVENTS_MASK) {
+ Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "requested illegal events; ",
+ "only key, button, motion, enter, leave, and virtual ",
+ "events may be used", (char *)NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
}
-int
-Blt_ConfigureBindingsFromObj(
- Tcl_Interp* interp,
- BindTable *bindPtr,
- ClientData item,
- int objc,
- Tcl_Obj* const objv[])
+int Blt_ConfigureBindingsFromObj(
+ Tcl_Interp* interp,
+ BindTable *bindPtr,
+ ClientData item,
+ int objc,
+ Tcl_Obj* const objv[])
{
- const char *command;
- unsigned long mask;
- const char *seq;
- const char *string;
-
- if (objc == 0) {
- Tk_GetAllBindings(interp, bindPtr->bindingTable, item);
- return TCL_OK;
- }
- string = Tcl_GetString(objv[0]);
- if (objc == 1) {
- command = Tk_GetBinding(interp, bindPtr->bindingTable, item, string);
- if (command == NULL) {
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "invalid binding event \"", string, "\"",
- (char *)NULL);
- return TCL_ERROR;
- }
- Tcl_SetStringObj(Tcl_GetObjResult(interp), command, -1);
- return TCL_OK;
- }
-
- seq = string;
- command = Tcl_GetString(objv[1]);
-
- if (command[0] == '\0') {
- return Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
- }
+ const char *command;
+ unsigned long mask;
+ const char *seq;
+ const char *string;
- if (command[0] == '+') {
- mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
- command + 1, TRUE);
- } else {
- mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
- command, FALSE);
- }
- if (mask == 0) {
- return TCL_ERROR;
- }
- if (mask & (unsigned)~ALL_VALID_EVENTS_MASK) {
- Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
- Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "requested illegal events; ",
- "only key, button, motion, enter, leave, and virtual ",
- "events may be used", (char *)NULL);
- return TCL_ERROR;
+ if (objc == 0) {
+ Tk_GetAllBindings(interp, bindPtr->bindingTable, item);
+ return TCL_OK;
+ }
+ string = Tcl_GetString(objv[0]);
+ if (objc == 1) {
+ command = Tk_GetBinding(interp, bindPtr->bindingTable, item, string);
+ if (command == NULL) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "invalid binding event \"", string, "\"",
+ (char *)NULL);
+ return TCL_ERROR;
}
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), command, -1);
return TCL_OK;
+ }
+
+ seq = string;
+ command = Tcl_GetString(objv[1]);
+
+ if (command[0] == '\0') {
+ return Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
+ }
+
+ if (command[0] == '+') {
+ mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
+ command + 1, TRUE);
+ } else {
+ mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
+ command, FALSE);
+ }
+ if (mask == 0) {
+ return TCL_ERROR;
+ }
+ if (mask & (unsigned)~ALL_VALID_EVENTS_MASK) {
+ Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, "requested illegal events; ",
+ "only key, button, motion, enter, leave, and virtual ",
+ "events may be used", (char *)NULL);
+ return TCL_ERROR;
+ }
+ return TCL_OK;
}
-Blt_BindTable
-Blt_CreateBindingTable(
- Tcl_Interp* interp,
- Tk_Window tkwin,
- ClientData clientData,
- Blt_BindPickProc *pickProc,
- Blt_BindTagProc *tagProc)
+Blt_BindTable Blt_CreateBindingTable(
+ Tcl_Interp* interp,
+ Tk_Window tkwin,
+ ClientData clientData,
+ Blt_BindPickProc *pickProc,
+ Blt_BindTagProc *tagProc)
{
- unsigned int mask;
- BindTable *bindPtr;
-
- bindPtr = calloc(1, sizeof(BindTable));
- bindPtr->bindingTable = Tk_CreateBindingTable(interp);
- bindPtr->clientData = clientData;
- bindPtr->tkwin = tkwin;
- bindPtr->pickProc = pickProc;
- bindPtr->tagProc = tagProc;
- mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
- ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
- PointerMotionMask);
- Tk_CreateEventHandler(tkwin, mask, BindProc, bindPtr);
- return bindPtr;
+ unsigned int mask;
+ BindTable *bindPtr;
+
+ bindPtr = calloc(1, sizeof(BindTable));
+ bindPtr->bindingTable = Tk_CreateBindingTable(interp);
+ bindPtr->clientData = clientData;
+ bindPtr->tkwin = tkwin;
+ bindPtr->pickProc = pickProc;
+ bindPtr->tagProc = tagProc;
+ mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
+ ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
+ PointerMotionMask);
+ Tk_CreateEventHandler(tkwin, mask, BindProc, bindPtr);
+ return bindPtr;
}
-void
-Blt_DestroyBindingTable(BindTable *bindPtr)
+void Blt_DestroyBindingTable(BindTable *bindPtr)
{
- unsigned int mask;
-
- Tk_DeleteBindingTable(bindPtr->bindingTable);
- mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
- ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
- PointerMotionMask);
- Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr);
- free(bindPtr);
- bindPtr = NULL;
+ unsigned int mask;
+
+ Tk_DeleteBindingTable(bindPtr->bindingTable);
+ mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
+ ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
+ PointerMotionMask);
+ Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr);
+ free(bindPtr);
+ bindPtr = NULL;
}
-void
-Blt_PickCurrentItem(BindTable *bindPtr)
+void Blt_PickCurrentItem(BindTable *bindPtr)
{
- if (bindPtr->activePick) {
- PickCurrentItem(bindPtr, &bindPtr->pickEvent);
- }
+ if (bindPtr->activePick) {
+ PickCurrentItem(bindPtr, &bindPtr->pickEvent);
+ }
}
-void
-Blt_DeleteBindings(
- BindTable *bindPtr,
- ClientData object)
+void Blt_DeleteBindings(BindTable *bindPtr, ClientData object)
{
- Tk_DeleteAllBindings(bindPtr->bindingTable, object);
-
- /*
- * If this is the object currently picked, we need to repick one.
- */
- if (bindPtr->currentItem == object) {
- bindPtr->currentItem = NULL;
- bindPtr->currentContext = NULL;
- }
- if (bindPtr->newItem == object) {
- bindPtr->newItem = NULL;
- bindPtr->newContext = NULL;
- }
- if (bindPtr->focusItem == object) {
- bindPtr->focusItem = NULL;
- bindPtr->focusContext = NULL;
- }
+ Tk_DeleteAllBindings(bindPtr->bindingTable, object);
+
+ // If this is the object currently picked, we need to repick one.
+ if (bindPtr->currentItem == object) {
+ bindPtr->currentItem = NULL;
+ bindPtr->currentContext = NULL;
+ }
+ if (bindPtr->newItem == object) {
+ bindPtr->newItem = NULL;
+ bindPtr->newContext = NULL;
+ }
+ if (bindPtr->focusItem == object) {
+ bindPtr->focusItem = NULL;
+ bindPtr->focusContext = NULL;
+ }
}
-void
-Blt_MoveBindingTable(
- BindTable *bindPtr,
- Tk_Window tkwin)
+void Blt_MoveBindingTable(BindTable *bindPtr, Tk_Window tkwin)
{
- unsigned int mask;
+ unsigned int mask;
- mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
- ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
- PointerMotionMask);
- if (bindPtr->tkwin != NULL) {
- Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr);
- }
- Tk_CreateEventHandler(tkwin, mask, BindProc, bindPtr);
- bindPtr->tkwin = tkwin;
+ mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask |
+ ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
+ PointerMotionMask);
+ if (bindPtr->tkwin != NULL) {
+ Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr);
+ }
+ Tk_CreateEventHandler(tkwin, mask, BindProc, bindPtr);
+ bindPtr->tkwin = tkwin;
}
/*
@@ -663,10 +630,10 @@ Blt_MoveBindingTable(
* XEvent (including Tk's XVirtualEvent extension).
*/
typedef union {
- KeySym keySym; /* KeySym that corresponds to xkey.keycode. */
- int button; /* Button that was pressed (xbutton.button). */
- Tk_Uid name; /* Tk_Uid of virtual event. */
- ClientData clientData; /* Used when type of Detail is unknown, and to
+ KeySym keySym; /* KeySym that corresponds to xkey.keycode. */
+ int button; /* Button that was pressed (xbutton.button). */
+ Tk_Uid name; /* Tk_Uid of virtual event. */
+ ClientData clientData; /* Used when type of Detail is unknown, and to
* ensure that all bytes of Detail are initialized
* when this structure is used in a hash key. */
} Detail;
@@ -677,11 +644,11 @@ typedef union {
* events as part of the process of converting X events into TCL commands.
*/
typedef struct {
- int eventType; /* Type of X event, e.g. ButtonPress. */
- int needMods; /* Mask of modifiers that must be
- * present (0 means no modifiers are
- * required). */
- Detail detail; /* Additional information that must
+ int eventType; /* Type of X event, e.g. ButtonPress. */
+ int needMods; /* Mask of modifiers that must be
+ * present (0 means no modifiers are
+ * required). */
+ Detail detail; /* Additional information that must
* match event. Normally this is 0,
* meaning no additional information
* must match. For KeyPress and
@@ -696,10 +663,10 @@ typedef struct {
} Pattern;
typedef struct {
- const char *name; /* Name of modifier. */
- int mask; /* Button/modifier mask value, such as
+ const char *name; /* Name of modifier. */
+ int mask; /* Button/modifier mask value, such as
* Button1Mask. */
- int flags; /* Various flags; see below for
+ int flags; /* Various flags; see below for
* definitions. */
} EventModifier;
@@ -724,10 +691,10 @@ typedef struct {
#define ALT_MASK (AnyModifier<<2)
typedef struct {
- const char *name; /* Name of event. */
- int type; /* Event type for X, such as
+ const char *name; /* Name of event. */
+ int type; /* Event type for X, such as
* ButtonPress. */
- int eventMask; /* Mask bits (for XSelectInput)
+ int eventMask; /* Mask bits (for XSelectInput)
* for this event type. */
} EventInfo;
@@ -773,5 +740,3 @@ typedef struct {
#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|CROSSING|VIRTUAL)
-
-
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index d4c18d3..24ed966 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -262,22 +262,23 @@ static void DestroyMarker(Marker *markerPtr)
Blt_DeleteBindings(graphPtr->bindTable, markerPtr);
+ if (markerPtr->obj.name)
+ free((void*)markerPtr->obj.name);
+
if (markerPtr->hashPtr)
Tcl_DeleteHashEntry(markerPtr->hashPtr);
if (markerPtr->link)
Blt_Chain_DeleteLink(graphPtr->markers.displayList, markerPtr->link);
- // if (markerPtr->axes)
- // ReleaseAxis(markerPtr->axes);
+ if (markerPtr->axes.x)
+ Blt_ReleaseAxis(markerPtr->axes.x);
+ if (markerPtr->axes.y)
+ Blt_ReleaseAxis(markerPtr->axes.y);
if (markerPtr->worldPts)
free(markerPtr->worldPts);
- // will be freed via Tk_FreeConfigOptions
- // if (markerPtr->obj.name)
- // free((void*)(markerPtr->obj.name));
-
Tk_FreeConfigOptions((char*)markerPtr, markerPtr->optionTable,
graphPtr->tkwin);
diff --git a/src/bltGrMarkerLine.C b/src/bltGrMarkerLine.C
index 88a66e2..edda9ec 100644
--- a/src/bltGrMarkerLine.C
+++ b/src/bltGrMarkerLine.C
@@ -102,8 +102,6 @@ Marker* Blt_CreateLineProc(Graph* graphPtr)
LineMarker* lmPtr = (LineMarker*)calloc(1, sizeof(LineMarker));
lmPtr->classPtr = &lineMarkerClass;
lmPtr->xorr = FALSE;
- lmPtr->capStyle = CapButt;
- lmPtr->joinStyle = JoinMiter;
lmPtr->optionTable = Tk_CreateOptionTable(graphPtr->interp, optionSpecs);
return (Marker*)lmPtr;
@@ -182,11 +180,11 @@ static int ConfigureLineProc(Marker *markerPtr)
drawable = Tk_WindowId(graphPtr->tkwin);
gcMask = (GCLineWidth | GCLineStyle | GCCapStyle | GCJoinStyle);
- if (lmPtr->outlineColor != NULL) {
+ if (lmPtr->outlineColor) {
gcMask |= GCForeground;
gcValues.foreground = lmPtr->outlineColor->pixel;
}
- if (lmPtr->fillColor != NULL) {
+ if (lmPtr->fillColor) {
gcMask |= GCBackground;
gcValues.background = lmPtr->fillColor->pixel;
}
@@ -213,7 +211,7 @@ static int ConfigureLineProc(Marker *markerPtr)
}
}
newGC = Blt_GetPrivateGC(graphPtr->tkwin, gcMask, &gcValues);
- if (lmPtr->gc != NULL) {
+ if (lmPtr->gc) {
Blt_FreePrivateGC(graphPtr->display, lmPtr->gc);
}
if (LineIsDashed(lmPtr->dashes)) {
@@ -243,7 +241,7 @@ static void LineToPostscriptProc(Marker *markerPtr, Blt_Ps ps)
Blt_Ps_XSetLineAttributes(ps, lmPtr->outlineColor,
lmPtr->lineWidth, &lmPtr->dashes, lmPtr->capStyle,
lmPtr->joinStyle);
- if ((LineIsDashed(lmPtr->dashes)) && (lmPtr->fillColor != NULL)) {
+ if ((LineIsDashed(lmPtr->dashes)) && (lmPtr->fillColor)) {
Blt_Ps_Append(ps, "/DashesProc {\n gsave\n ");
Blt_Ps_XSetBackground(ps, lmPtr->fillColor);
Blt_Ps_Append(ps, " ");
@@ -264,10 +262,10 @@ static void FreeLineProc(Marker *markerPtr)
LineMarker *lmPtr = (LineMarker *)markerPtr;
Graph* graphPtr = markerPtr->obj.graphPtr;
- if (lmPtr->gc != NULL) {
+ if (lmPtr->gc) {
Blt_FreePrivateGC(graphPtr->display, lmPtr->gc);
}
- if (lmPtr->segments != NULL) {
+ if (lmPtr->segments) {
free(lmPtr->segments);
}
}
@@ -278,7 +276,7 @@ static void MapLineProc(Marker *markerPtr)
LineMarker *lmPtr = (LineMarker *)markerPtr;
lmPtr->nSegments = 0;
- if (lmPtr->segments != NULL)
+ if (lmPtr->segments)
free(lmPtr->segments);
if (markerPtr->nWorldPts < 2)
diff --git a/src/bltGrMarkerLine.h b/src/bltGrMarkerLine.h
index 31b862c..ab987c9 100644
--- a/src/bltGrMarkerLine.h
+++ b/src/bltGrMarkerLine.h
@@ -71,9 +71,6 @@ class LineMarker {
int state;
- struct {
- } opts;
-
XColor* fillColor;
XColor* outlineColor; /* Foreground and background colors */
diff --git a/src/bltGrMarkerPolygon.C b/src/bltGrMarkerPolygon.C
index 07290ae..db4a80d 100644
--- a/src/bltGrMarkerPolygon.C
+++ b/src/bltGrMarkerPolygon.C
@@ -106,8 +106,6 @@ Marker* Blt_CreatePolygonProc(Graph* graphPtr)
{
PolygonMarker* pmPtr = (PolygonMarker*)calloc(1, sizeof(PolygonMarker));
pmPtr->classPtr = &polygonMarkerClass;
- pmPtr->capStyle = CapButt;
- pmPtr->joinStyle = JoinMiter;
pmPtr->optionTable = Tk_CreateOptionTable(graphPtr->interp, optionSpecs);
return (Marker*)pmPtr;
diff --git a/src/bltGrMarkerPolygon.h b/src/bltGrMarkerPolygon.h
index 3570b3d..45c70d1 100644
--- a/src/bltGrMarkerPolygon.h
+++ b/src/bltGrMarkerPolygon.h
@@ -71,6 +71,8 @@ class PolygonMarker {
int state;
+ // derived
+
Point2d *screenPts; /* Array of points representing the
* polygon in screen coordinates. It's
* not used for drawing, but to generate
diff --git a/src/bltGrMarkerText.C b/src/bltGrMarkerText.C
index 671300c..6060c08 100644
--- a/src/bltGrMarkerText.C
+++ b/src/bltGrMarkerText.C
@@ -108,9 +108,6 @@ Marker* Blt_CreateTextProc(Graph* graphPtr)
TextMarker* tmPtr = (TextMarker*)calloc(1, sizeof(TextMarker));
tmPtr->classPtr = &textMarkerClass;
Blt_Ts_InitStyle(tmPtr->style);
- tmPtr->style.anchor = TK_ANCHOR_NW;
- tmPtr->style.xPad = 4;
- tmPtr->style.yPad = 4;
tmPtr->optionTable = Tk_CreateOptionTable(graphPtr->interp, optionSpecs);
return (Marker *)tmPtr;
@@ -129,12 +126,12 @@ static int ConfigureTextProc(Marker *markerPtr)
tmPtr->style.angle += 360.0f;
}
newGC = NULL;
- if (tmPtr->fillColor != NULL) {
+ if (tmPtr->fillColor) {
gcMask = GCForeground;
gcValues.foreground = tmPtr->fillColor->pixel;
newGC = Tk_GetGC(graphPtr->tkwin, gcMask, &gcValues);
}
- if (tmPtr->fillGC != NULL) {
+ if (tmPtr->fillGC) {
Tk_FreeGC(graphPtr->display, tmPtr->fillGC);
}
tmPtr->fillGC = newGC;
@@ -257,7 +254,7 @@ static void DrawTextProc(Marker *markerPtr, Drawable drawable)
if (tmPtr->string == NULL) {
return;
}
- if (tmPtr->fillGC != NULL) {
+ if (tmPtr->fillGC) {
XPoint points[4];
int i;
@@ -272,7 +269,7 @@ static void DrawTextProc(Marker *markerPtr, Drawable drawable)
XFillPolygon(graphPtr->display, drawable, tmPtr->fillGC, points, 4,
Convex, CoordModeOrigin);
}
- if (tmPtr->style.color != NULL) {
+ if (tmPtr->style.color) {
Blt_Ts_DrawText(graphPtr->tkwin, drawable, tmPtr->string, -1,
&tmPtr->style, (int)tmPtr->anchorPt.x, (int)tmPtr->anchorPt.y);
}
@@ -285,7 +282,7 @@ static void TextToPostscriptProc(Marker *markerPtr, Blt_Ps ps)
if (tmPtr->string == NULL) {
return;
}
- if (tmPtr->fillGC != NULL) {
+ if (tmPtr->fillGC) {
Point2d points[4];
int i;
diff --git a/src/bltGraph.h b/src/bltGraph.h
index 8e55c13..6c0f56a 100644
--- a/src/bltGraph.h
+++ b/src/bltGraph.h
@@ -494,6 +494,8 @@ extern int Blt_AxisOp(Graph* graphPtr, Tcl_Interp* interp,
extern int Blt_DefAxisOp(Tcl_Interp* interp, Graph* graphPtr, int margin,
int objc, Tcl_Obj* const objv[]);
+extern void Blt_ReleaseAxis(Axis *axisPtr);
+
extern int Blt_ElementOp(Graph* graphPtr, Tcl_Interp* interp, int objc,
Tcl_Obj* const objv[], ClassId classId);