summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-05-22 18:23:37 (GMT)
committerjoye <joye>2014-05-22 18:23:37 (GMT)
commit0431617ada56f9ce9649311b8b298a8c4c87839c (patch)
tree125ea76bde140535ac67999319ccecc0a4f6747b
parentaf45850d31b3e6584ca2c737ff78f9c793668c46 (diff)
downloadblt-0431617ada56f9ce9649311b8b298a8c4c87839c.zip
blt-0431617ada56f9ce9649311b8b298a8c4c87839c.tar.gz
blt-0431617ada56f9ce9649311b8b298a8c4c87839c.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrAxis.C6
-rw-r--r--src/bltGrBind.C423
-rw-r--r--src/bltGrElem.C12
-rw-r--r--src/bltGrMarker.C11
-rw-r--r--src/bltGraph.C13
5 files changed, 138 insertions, 327 deletions
diff --git a/src/bltGrAxis.C b/src/bltGrAxis.C
index 65bbe79..9aa4e3d 100644
--- a/src/bltGrAxis.C
+++ b/src/bltGrAxis.C
@@ -274,14 +274,14 @@ Axis::~Axis()
if (link)
Blt_Chain_DeleteLink(chain, link);
+ if (hashPtr_)
+ Tcl_DeleteHashEntry(hashPtr_);
+
if (name_)
delete [] name_;
if (className_)
delete [] className_;
- if (hashPtr_)
- Tcl_DeleteHashEntry(hashPtr_);
-
if (tickGC_)
Tk_FreeGC(graphPtr_->display_, tickGC_);
diff --git a/src/bltGrBind.C b/src/bltGrBind.C
index 6b423c5..383f431 100644
--- a/src/bltGrBind.C
+++ b/src/bltGrBind.C
@@ -36,17 +36,12 @@ extern "C" {
#define MAX_STATIC_TAGS 64
static Tk_EventProc BindProc;
-
typedef struct _Blt_BindTable BindTable;
-/*
- * Binding table procedures.
- */
#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)
@@ -59,43 +54,11 @@ typedef struct _Blt_BindTable BindTable;
LeaveWindowMask | KeyPressMask | KeyReleaseMask | \
PointerMotionMask | VirtualEventMask)
- static int buttonMasks[] =
- {0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask};
-
-
-/*
- * How to make drag&drop work?
- *
- * Right now we generate pseudo <Enter> <Leave> events within button grab
- * on an object. They're marked NotifyVirtual instead of NotifyAncestor.
- * A better solution: generate new-style virtual <<DragEnter>>
- * <<DragMotion>> <<DragLeave>> events. These virtual events don't have
- * to exist as "real" event sequences, like virtual events do now.
- */
+ static int buttonMasks[] = {0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask};
-/*
- *---------------------------------------------------------------------------
- *
- * DoEvent --
- *
- * This procedure is called to invoke binding processing for a new event
- * that is associated with the current item for a legend.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Depends on the bindings for the legend. A binding script could delete
- * an entry, so callers should protect themselves with Tcl_Preserve and
- * Tcl_Release.
- *
- *---------------------------------------------------------------------------
- */
-static void DoEvent(BindTable *bindPtr, XEvent *eventPtr,
- ClientData item, ClientData context)
+static void DoEvent(BindTable *bindPtr, XEvent *eventPtr, ClientData item,
+ ClientData context)
{
- Blt_List tagList;
-
if (!bindPtr->tkwin || !bindPtr->bindingTable)
return;
@@ -107,7 +70,7 @@ static void DoEvent(BindTable *bindPtr, XEvent *eventPtr,
return;
// Invoke the binding system.
- tagList = Blt_List_Create(BLT_ONE_WORD_KEYS);
+ Blt_List tagList = Blt_List_Create(BLT_ONE_WORD_KEYS);
if (!bindPtr->tagProc) {
Blt_List_Append(tagList, Tk_GetUid("all"), 0);
Blt_List_Append(tagList, (char *)item, 0);
@@ -119,56 +82,49 @@ static void DoEvent(BindTable *bindPtr, XEvent *eventPtr,
ClientData staticTags[MAX_STATIC_TAGS];
ClientData *tagArray = staticTags;
int nTags = Blt_List_GetLength(tagList);
- if (nTags >= MAX_STATIC_TAGS) {
+ if (nTags >= MAX_STATIC_TAGS)
tagArray = (ClientData*)malloc(sizeof(ClientData) * nTags);
-
- }
+
nTags = 0;
- for (Blt_ListNode node = Blt_List_FirstNode(tagList); node != NULL;
- node = Blt_List_NextNode(node)) {
+ for (Blt_ListNode node = Blt_List_FirstNode(tagList); node;
+ node = Blt_List_NextNode(node))
tagArray[nTags++] = (ClientData)Blt_List_GetKey(node);
- }
+
Tk_BindEvent(bindPtr->bindingTable, eventPtr, bindPtr->tkwin, nTags,
tagArray);
- if (tagArray != staticTags) {
+
+ if (tagArray != staticTags)
free(tagArray);
- }
}
+
Blt_List_Destroy(tagList);
}
static void PickCurrentItem(BindTable *bindPtr, XEvent *eventPtr)
{
- 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.
+
int 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.
- */
+ // 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)) {
+ 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.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;
@@ -180,39 +136,32 @@ static void PickCurrentItem(BindTable *bindPtr, XEvent *eventPtr)
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.same_screen = eventPtr->xmotion.same_screen;
bindPtr->pickEvent.xcrossing.focus = False;
bindPtr->pickEvent.xcrossing.state = eventPtr->xmotion.state;
- } else {
- bindPtr->pickEvent = *eventPtr;
}
+ else
+ bindPtr->pickEvent = *eventPtr;
+
}
bindPtr->activePick = 1;
- /*
- * 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 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;
+ // A LeaveNotify event automatically means that there's no current item,
+ // so the check for closest item can be skipped.
+ ClientData newContext =NULL;
+ ClientData newItem =NULL;
if (bindPtr->pickEvent.type != LeaveNotify) {
- int x, y;
-
- x = bindPtr->pickEvent.xcrossing.x;
- y = bindPtr->pickEvent.xcrossing.y;
+ int x = bindPtr->pickEvent.xcrossing.x;
+ int y = bindPtr->pickEvent.xcrossing.y;
newItem = (*bindPtr->pickProc) (bindPtr->clientData, x, y, &newContext);
}
- else
- newItem = NULL;
// Nothing to do: the current item hasn't changed.
if (((newItem == bindPtr->currentItem) &&
@@ -220,95 +169,77 @@ static void PickCurrentItem(BindTable *bindPtr, XEvent *eventPtr)
((bindPtr->flags & LEFT_GRABBED_ITEM) == 0))
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;
+ // 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.
+ ClientData 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;
+ if ((bindPtr->currentItem != NULL) && ((newItem != bindPtr->currentItem) || (newContext != bindPtr->currentContext)) && ((bindPtr->flags & LEFT_GRABBED_ITEM) == 0)) {
+ XEvent 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.
- */
+
+ // 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.
- */
+ // 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;
+ if (((newItem != bindPtr->currentItem) || (newContext != bindPtr->currentContext)) && (buttonDown)) {
bindPtr->flags |= LEFT_GRABBED_ITEM;
- event = bindPtr->pickEvent;
+ XEvent 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;
+
+ // 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.
+ ClientData savedItem = bindPtr->currentItem;
+ ClientData savedContext = bindPtr->currentContext;
if (bindPtr->newItem != NULL) {
event.type = LeaveNotify;
- event.xcrossing.detail = NotifyVirtual /* Ancestor */ ;
+ 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 */ ;
+ 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.
- */
+ // 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);
@@ -316,57 +247,52 @@ static void PickCurrentItem(BindTable *bindPtr, XEvent *eventPtr)
static void BindProc(ClientData clientData, XEvent *eventPtr)
{
+ // 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.
+
BindTable *bindPtr = (BindTable*)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];
- }
- /*
- * 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;
+ {
+ int 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;
@@ -379,18 +305,17 @@ static void BindProc(ClientData clientData, XEvent *eventPtr)
case MotionNotify:
bindPtr->state = eventPtr->xmotion.state;
PickCurrentItem(bindPtr, eventPtr);
- DoEvent(bindPtr, eventPtr, bindPtr->currentItem,
- bindPtr->currentContext);
+ 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);
+ DoEvent(bindPtr, eventPtr, bindPtr->currentItem, bindPtr->currentContext);
break;
}
+
Tcl_Release(bindPtr->clientData);
}
@@ -404,13 +329,12 @@ int Blt_ConfigureBindingsFromObj(Tcl_Interp* interp, BindTable *bindPtr,
}
const char *string = Tcl_GetString(objv[0]);
- const char *command;
if (objc == 1) {
- command = Tk_GetBinding(interp, bindPtr->bindingTable, item, string);
+ const char* command =
+ Tk_GetBinding(interp, bindPtr->bindingTable, item, string);
if (!command) {
Tcl_ResetResult(interp);
- Tcl_AppendResult(interp, "invalid binding event \"", string, "\"",
- (char *)NULL);
+ Tcl_AppendResult(interp, "invalid binding event \"", string, "\"", NULL);
return TCL_ERROR;
}
Tcl_SetStringObj(Tcl_GetObjResult(interp), command, -1);
@@ -418,8 +342,7 @@ int Blt_ConfigureBindingsFromObj(Tcl_Interp* interp, BindTable *bindPtr,
}
const char *seq = string;
- command = Tcl_GetString(objv[1]);
-
+ const char* command = Tcl_GetString(objv[1]);
if (command[0] == '\0')
return Tk_DeleteBinding(interp, bindPtr->bindingTable, item, seq);
@@ -430,7 +353,6 @@ int Blt_ConfigureBindingsFromObj(Tcl_Interp* interp, BindTable *bindPtr,
else
mask = Tk_CreateBinding(interp, bindPtr->bindingTable, item, seq,
command, 0);
-
if (!mask)
return TCL_ERROR;
@@ -472,6 +394,7 @@ void Blt_DestroyBindingTable(BindTable *bindPtr)
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
PointerMotionMask);
Tk_DeleteEventHandler(bindPtr->tkwin, mask, BindProc, bindPtr);
+
free(bindPtr);
bindPtr = NULL;
}
@@ -491,128 +414,14 @@ void Blt_DeleteBindings(BindTable *bindPtr, ClientData 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;
}
}
-
-/*
- * The following union is used to hold the detail information from an
- * 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
- * ensure that all bytes of Detail are initialized
- * when this structure is used in a hash key. */
-} Detail;
-
-
-/*
- * The following structure defines a pattern, which is matched against X
- * 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
- * match event. Normally this is 0,
- * meaning no additional information
- * must match. For KeyPress and
- * KeyRelease events, a keySym may
- * be specified to select a
- * particular keystroke (0 means any
- * keystrokes). For button events,
- * specifies a particular button (0
- * means any buttons are OK). For virtual
- * events, specifies the Tk_Uid of the
- * virtual event name (never 0). */
-} Pattern;
-
-typedef struct {
- const char *name; /* Name of modifier. */
- int mask; /* Button/modifier mask value, such as
- * Button1Mask. */
- int flags; /* Various flags; see below for
- * definitions. */
-} EventModifier;
-
-/*
- * Flags for EventModifier structures:
- *
- * DOUBLE - Non-zero means duplicate this event,
- * e.g. for double-clicks.
- * TRIPLE - Non-zero means triplicate this event,
- * e.g. for triple-clicks.
- * QUADRUPLE - Non-zero means quadruple this event,
- * e.g. for 4-fold-clicks.
- * MULT_CLICKS - Combination of all of above.
- */
-
-#define DOUBLE (1<<0)
-#define TRIPLE (1<<1)
-#define QUADRUPLE (1<<2)
-#define MULT_CLICKS (DOUBLE|TRIPLE|QUADRUPLE)
-
-#define META_MASK (AnyModifier<<1)
-#define ALT_MASK (AnyModifier<<2)
-
-typedef struct {
- const char *name; /* Name of event. */
- int type; /* Event type for X, such as
- * ButtonPress. */
- int eventMask; /* Mask bits (for XSelectInput)
- * for this event type. */
-} EventInfo;
-
-/*
- * Note: some of the masks below are an OR-ed combination of
- * several masks. This is necessary because X doesn't report
- * up events unless you also ask for down events. Also, X
- * doesn't report button state in motion events unless you've
- * asked about button events.
- */
-
-/*
- * The defines and table below are used to classify events into
- * various groups. The reason for this is that logically identical
- * fields (e.g. "state") appear at different places in different
- * types of events. The classification masks can be used to figure
- * out quickly where to extract information from events.
- */
-
-#define KEY 0x1
-#define BUTTON 0x2
-#define MOTION 0x4
-#define CROSSING 0x8
-//#define FOCUS 0x10
-#define EXPOSE 0x20
-#define VISIBILITY 0x40
-#define CREATE 0x80
-#define DESTROY 0x100
-#define UNMAP 0x200
-#define MAP 0x400
-#define REPARENT 0x800
-#define CONFIG 0x1000
-#define GRAVITY 0x2000
-#define CIRC 0x4000
-#define PROP 0x8000
-#define COLORMAP 0x10000
-#define VIRTUAL 0x20000
-#define ACTIVATE 0x40000
-#define MAPREQ 0x80000
-#define CONFIGREQ 0x100000
-#define RESIZEREQ 0x200000
-#define CIRCREQ 0x400000
-
-#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
-#define KEY_BUTTON_MOTION_CROSSING (KEY|BUTTON|MOTION|CROSSING|VIRTUAL)
diff --git a/src/bltGrElem.C b/src/bltGrElem.C
index 9f96185..9fd1490 100644
--- a/src/bltGrElem.C
+++ b/src/bltGrElem.C
@@ -58,15 +58,21 @@ Element::Element(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr)
Element::~Element()
{
+ if (graphPtr_->bindTable_)
+ Blt_DeleteBindings(graphPtr_->bindTable_, this);
+
+ if (link)
+ Blt_Chain_DeleteLink(graphPtr_->elements_.displayList, link);
+
+ if (hashPtr_)
+ Tcl_DeleteHashEntry(hashPtr_);
+
if (name_)
delete [] name_;
if (activeIndices_)
free(activeIndices_);
- if (hashPtr_)
- Tcl_DeleteHashEntry(hashPtr_);
-
Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_);
free(ops_);
}
diff --git a/src/bltGrMarker.C b/src/bltGrMarker.C
index 5931abb..42de466 100644
--- a/src/bltGrMarker.C
+++ b/src/bltGrMarker.C
@@ -57,16 +57,17 @@ Marker::Marker(Graph* gPtr, const char* nPtr, Tcl_HashEntry* hPtr)
Marker::~Marker()
{
- Blt_DeleteBindings(graphPtr_->bindTable_, this);
+ if (graphPtr_->bindTable_)
+ Blt_DeleteBindings(graphPtr_->bindTable_, this);
- if (name_)
- delete [] name_;
+ if (link)
+ Blt_Chain_DeleteLink(graphPtr_->markers_.displayList, link);
if (hashPtr_)
Tcl_DeleteHashEntry(hashPtr_);
- if (link)
- Blt_Chain_DeleteLink(graphPtr_->markers_.displayList, link);
+ if (name_)
+ delete [] name_;
Tk_FreeConfigOptions((char*)ops_, optionTable_, graphPtr_->tkwin_);
free(ops_);
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 03f64c0..570bbd7 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -220,14 +220,14 @@ int Graph::configure()
void Graph::map()
{
if (flags & RESET) {
- cerr << "RESET" << endl;
+ // cerr << "RESET" << endl;
resetAxes();
flags &= ~RESET;
flags |= LAYOUT;
}
if (flags & LAYOUT) {
- cerr << "LAYOUT" << endl;
+ // cerr << "LAYOUT" << endl;
layoutGraph();
mapAxes();
mapElements();
@@ -272,7 +272,7 @@ void Graph::draw()
// Update cache if needed
if (flags & CACHE) {
- cerr << "CACHE" << endl;
+ // cerr << "CACHE" << endl;
drawMargins(cache_);
switch (legend_->position()) {
@@ -353,7 +353,6 @@ void Graph::draw()
enableCrosshairs();
Tk_FreePixmap(display_, drawable);
- cerr << "---" << endl;
}
int Graph::print(const char *ident, Blt_Ps ps)
@@ -656,12 +655,8 @@ int Graph::getPen(Tcl_Obj* objPtr, Pen** penPtrPtr)
void Graph::destroyElement(Element* elemPtr)
{
- Blt_DeleteBindings(bindTable_, elemPtr);
legend_->removeElement(elemPtr);
- if (elemPtr->link)
- Blt_Chain_DeleteLink(elements_.displayList, elemPtr->link);
-
delete elemPtr;
}
@@ -795,7 +790,7 @@ void Graph::mapMarkers()
continue;
if ((flags & MAP_MARKERS) || (markerPtr->flags & MAP_ITEM)) {
- cerr << "MAP_MARKERS" << endl;
+ // cerr << "MAP_MARKERS" << endl;
markerPtr->map();
markerPtr->flags &= ~MAP_ITEM;
}