diff options
author | treectrl <treectrl> | 2006-11-06 01:54:09 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2006-11-06 01:54:09 (GMT) |
commit | 5024f0fbd507d71349d7782b4ef0633861d708b2 (patch) | |
tree | 3c7fdd919f1a33e10abf2448bb6c1bbcfbfb3923 /generic/tkTreeItem.c | |
parent | 0973fa0f39e14ab62181b6416937e91bfdd2e5b5 (diff) | |
download | tktreectrl-5024f0fbd507d71349d7782b4ef0633861d708b2.zip tktreectrl-5024f0fbd507d71349d7782b4ef0633861d708b2.tar.gz tktreectrl-5024f0fbd507d71349d7782b4ef0633861d708b2.tar.bz2 |
Chopped out WALK_SPANS unused code.
Diffstat (limited to 'generic/tkTreeItem.c')
-rw-r--r-- | generic/tkTreeItem.c | 455 |
1 files changed, 1 insertions, 454 deletions
diff --git a/generic/tkTreeItem.c b/generic/tkTreeItem.c index 02e99a1..0936c4a 100644 --- a/generic/tkTreeItem.c +++ b/generic/tkTreeItem.c @@ -5,7 +5,7 @@ * * Copyright (c) 2002-2006 Tim Baker * - * RCS: @(#) $Id: tkTreeItem.c,v 1.76 2006/11/06 01:44:48 treectrl Exp $ + * RCS: @(#) $Id: tkTreeItem.c,v 1.77 2006/11/06 01:54:09 treectrl Exp $ */ #include "tkTreeCtrl.h" @@ -3776,8 +3776,6 @@ Item_GetSpans( } #endif -#define WALK_SPANS -#ifdef WALK_SPANS typedef int (*TreeItemWalkSpansProc)( TreeCtrl *tree, TreeItem item_, @@ -3993,149 +3991,6 @@ TreeItem_Draw( SpanWalkProc_Draw, (ClientData) &clientData); } -#else /* WALK_SPANS */ - -/* - *---------------------------------------------------------------------- - * - * TreeItem_Draw -- - * - * Draws part of an Item. - * - * Results: - * None. - * - * Side effects: - * Stuff is drawn in a drawable. - * - *---------------------------------------------------------------------- - */ - -void -TreeItem_Draw( - TreeCtrl *tree, /* Widget info. */ - TreeItem item_, /* Item token. */ -#ifdef COLUMN_LOCK - int lock, /* Which columns. */ -#endif - int x, int y, /* Drawable coordinates of the item. */ - int width, int height, /* Total size of the item. */ - Drawable drawable, /* Where to draw. */ - int minX, int maxX, /* Left/right edge that needs to be drawn. */ - int index /* Used to select a color from a - * tree-column's -itembackground option. */ - ) -{ - Item *self = (Item *) item_; - int indent, columnWidth, totalWidth; - Column *column; - StyleDrawArgs drawArgs; - TreeColumn treeColumn = tree->columns; - int i, spanCount, spanIndex, columnCount = tree->columnCountVis; - SpanInfo staticSpans[STATIC_SIZE], *spans = staticSpans; - int area = TREE_AREA_CONTENT; - -#ifdef COLUMN_LOCK - switch (lock) { - case COLUMN_LOCK_LEFT: - treeColumn = tree->columnLockLeft; - columnCount = tree->columnCountVisLeft; - area = TREE_AREA_LEFT; - break; - case COLUMN_LOCK_NONE: - treeColumn = tree->columnLockNone; - break; - case COLUMN_LOCK_RIGHT: - treeColumn = tree->columnLockRight; - columnCount = tree->columnCountVisRight; - area = TREE_AREA_RIGHT; - break; - } - STATIC_ALLOC(spans, SpanInfo, columnCount); - spanCount = Item_GetSpans(tree, item_, treeColumn, spans); -#else - STATIC_ALLOC(spans, SpanInfo, columnCount); - spanCount = Item_GetSpans(tree, item_, spans); -#endif - drawArgs.tree = tree; - drawArgs.drawable = drawable; - - /* The area should never be empty. */ - if (!Tree_AreaBbox(tree, area, &drawArgs.bounds[0], &drawArgs.bounds[1], - &drawArgs.bounds[2], &drawArgs.bounds[3])) { - drawArgs.bounds[0] = drawArgs.bounds[2] = 0; - drawArgs.bounds[1] = drawArgs.bounds[3] = 0; - } - - totalWidth = 0; - for (spanIndex = 0; spanIndex < spanCount; spanIndex++) { - treeColumn = spans[spanIndex].treeColumn; - column = (Column *) spans[spanIndex].itemColumn; - - /* If this is the single visible column, use the provided width which - * may be different than the column's width. */ - if ((tree->columnCountVis == 1) && (treeColumn == tree->columnVis)) { - columnWidth = width; - if ((columnWidth >= 0) && - (x + totalWidth < maxX) && - (x + totalWidth + columnWidth > minX)) { - ItemDrawBackground(tree, treeColumn, self, column, drawable, - x + totalWidth, y, columnWidth, height, index); - } - - /* More than one column is visible, or this is not the visible - * column. */ - } else { - TreeColumn treeColumn2 = treeColumn; - columnWidth = spans[spanIndex].width; - - /* Draw background colors. */ - for (i = 0; i < spans[spanIndex].span; i++) { - int column2Width = TreeColumn_UseWidth(treeColumn2); - int x2 = x + totalWidth + column2Width; - if ((column2Width >= 0) && (x2 < maxX) && - (x2 + column2Width > minX)) { - ItemDrawBackground(tree, treeColumn2, self, column, - drawable, x2, y, column2Width, height, index); - } - treeColumn2 = TreeColumn_Next(treeColumn2); - } - } - if (columnWidth <= 0) - continue; - if ((x + totalWidth < maxX) && (x + totalWidth + columnWidth > minX)) { - if ((column != NULL) && (column->style != NULL)) { - if (treeColumn == tree->columnTree) - indent = TreeItem_Indent(tree, item_); - else - indent = 0; - drawArgs.state = self->state | column->cstate; - drawArgs.style = column->style; - drawArgs.indent = indent; - drawArgs.x = x + totalWidth; - drawArgs.y = y; - drawArgs.width = columnWidth; - drawArgs.height = height; - drawArgs.justify = TreeColumn_Justify(treeColumn); - TreeStyle_Draw(&drawArgs); - } - if (treeColumn == tree->columnTree) { - if (tree->showLines) - TreeItem_DrawLines(tree, item_, x, y, width, height, - drawable); - if (tree->showButtons) - TreeItem_DrawButton(tree, item_, x, y, width, height, - drawable); - } - } - totalWidth += columnWidth; - } - - STATIC_FREE(spans, SpanInfo, columnCount); -} - -#endif /* WALK_SPANS */ - #else /* COLUMN_SPAN */ void TreeItem_Draw(TreeCtrl *tree, TreeItem item_, int x, int y, @@ -4486,7 +4341,6 @@ TreeItem_DrawButton( */ #ifdef COLUMN_SPAN -#ifdef WALK_SPANS static int SpanWalkProc_UpdateWindowPositions( TreeCtrl *tree, @@ -4526,102 +4380,6 @@ TreeItem_UpdateWindowPositions( SpanWalkProc_UpdateWindowPositions, (ClientData) NULL); } -#else /* WALK_SPANS */ -void -TreeItem_UpdateWindowPositions( - TreeCtrl *tree, /* Widget info. */ - TreeItem item_, /* Item token. */ -#ifdef COLUMN_LOCK - int lock, /* Columns we care about. */ -#endif - int x, int y, /* Window coordinates of the item. */ - int width, int height /* Total size of the item. */ - ) -{ - Item *self = (Item *) item_; - int indent, columnWidth, totalWidth; - Column *column; - StyleDrawArgs drawArgs; - TreeColumn treeColumn = tree->columns; - int spanIndex, spanCount, columnCount = tree->columnCountVis; - SpanInfo staticSpans[STATIC_SIZE], *spans = staticSpans; - int area = TREE_AREA_CONTENT; - int minX, maxX; - -#ifdef COLUMN_LOCK - switch (lock) { - case COLUMN_LOCK_LEFT: - treeColumn = tree->columnLockLeft; - columnCount = tree->columnCountVisLeft; - area = TREE_AREA_LEFT; - break; - case COLUMN_LOCK_NONE: - treeColumn = tree->columnLockNone; - break; - case COLUMN_LOCK_RIGHT: - treeColumn = tree->columnLockRight; - columnCount = tree->columnCountVisRight; - area = TREE_AREA_RIGHT; - break; - } - STATIC_ALLOC(spans, SpanInfo, columnCount); - spanCount = Item_GetSpans(tree, item_, treeColumn, spans); -#else - STATIC_ALLOC(spans, SpanInfo, columnCount); - spanCount = Item_GetSpans(tree, item_, spans); -#endif - - drawArgs.tree = tree; - drawArgs.drawable = None; - - if (!Tree_AreaBbox(tree, area, &drawArgs.bounds[0], &drawArgs.bounds[1], - &drawArgs.bounds[2], &drawArgs.bounds[3])) { - drawArgs.bounds[0] = drawArgs.bounds[2] = 0; - drawArgs.bounds[1] = drawArgs.bounds[3] = 0; - } - minX = drawArgs.bounds[0]; - maxX = drawArgs.bounds[2]; - - totalWidth = 0; - for (spanIndex = 0; spanIndex < spanCount; spanIndex++) { - treeColumn = spans[spanIndex].treeColumn; - column = (Column *) spans[spanIndex].itemColumn; - - /* If this is the single visible column, use the provided width which - * may be different than the column's width */ - if ((tree->columnCountVis == 1) && (treeColumn == tree->columnVis)) { - columnWidth = width; - - /* More than one column is visible, or this is not the visible - * column. */ - } else { - columnWidth = spans[spanIndex].width; - } - if (columnWidth <= 0) - continue; - if ((x + totalWidth < maxX) && (x + totalWidth + columnWidth > minX)) { - if ((column != NULL) && (column->style != NULL)) { - if (treeColumn == tree->columnTree) - indent = TreeItem_Indent(tree, item_); - else - indent = 0; - drawArgs.state = self->state | column->cstate; - drawArgs.style = column->style; - drawArgs.indent = indent; - drawArgs.x = x + totalWidth; - drawArgs.y = y; - drawArgs.width = columnWidth; - drawArgs.height = height; - drawArgs.justify = TreeColumn_Justify(treeColumn); - TreeStyle_UpdateWindowPositions(&drawArgs); - } - } - totalWidth += columnWidth; - } - STATIC_FREE(spans, SpanInfo, columnCount); -} -#endif /* WALK_SPANS */ - #else /* COLUMN_SPAN */ void TreeItem_UpdateWindowPositions( @@ -8541,8 +8299,6 @@ int TreeItem_Debug( #ifdef COLUMN_SPAN -#ifdef WALK_SPANS - /* *---------------------------------------------------------------------- * @@ -8720,215 +8476,6 @@ TreeItem_Identify2( SpanWalkProc_Identify2, (ClientData) &clientData); } -#else /* WALK_SPANS */ - -/* - *---------------------------------------------------------------------- - * - * TreeItem_Identify -- - * - * Determine which column and element the given point is in. - * This is used by the [identify] widget command. - * - * Results: - * If the Item is not ReallyVisible() or no columns are visible - * then buf[] is untouched. Otherwise the given string may be - * appended with "column C" followed by "elem E" although both - * are optional. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void -TreeItem_Identify( - TreeCtrl *tree, /* Widget info. */ - TreeItem item_, /* Item token. */ -#ifdef COLUMN_LOCK - int lock, /* Columns to hit-test. */ -#endif - int x, int y, /* Item coords to hit-test with. */ - char *buf /* NULL-terminated string which may be - * appended. */ - ) -{ - Item *self = (Item *) item_; - int left, top, width, height; - int indent, columnWidth, totalWidth; - Column *column; - StyleDrawArgs drawArgs; - TreeColumn treeColumn; - int i, spanIndex, spanCount; - SpanInfo staticSpans[STATIC_SIZE], *spans = staticSpans; - char *elem; - -#ifdef COLUMN_LOCK - if (Tree_ItemBbox(tree, item_, lock, &left, &top, &width, &height) < 0) -#else - if (Tree_ItemBbox(tree, item_, &left, &top, &width, &height) < 0) -#endif - return; - - STATIC_ALLOC(spans, SpanInfo, tree->columnCount); -#ifdef COLUMN_LOCK - Item_GetSpans(tree, item_, lock, spans); -#else - Item_GetSpans(tree, item_, spans); -#endif - - drawArgs.tree = tree; - drawArgs.drawable = None; - - totalWidth = 0; - for (columnIndex = 0; columnIndex < tree->columnCount; columnIndex++) { - treeColumn = spans[columnIndex].treeColumn; - if (spans[columnIndex].itemColumnIndex != columnIndex) - continue; - if ((tree->columnCountVis == 1) && (treeColumn == tree->columnVis)) - columnWidth = width; - else { - columnWidth = 0; - for (i = columnIndex; i < tree->columnCount; i++) { - if (spans[i].itemColumnIndex != columnIndex) - break; - columnWidth += spans[i].width; - } - } - if (columnWidth <= 0) - continue; - if (treeColumn == tree->columnTree) - indent = TreeItem_Indent(tree, item_); - else - indent = 0; - if ((x >= totalWidth + indent) && (x < totalWidth + columnWidth)) { - sprintf(buf + strlen(buf), " column %s%d", - tree->columnPrefix, TreeColumn_GetID(treeColumn)); - column = (Column *) spans[columnIndex].itemColumn; - if ((column != NULL) && (column->style != NULL)) { - drawArgs.state = self->state | column->cstate; - drawArgs.style = column->style; - drawArgs.indent = indent; - drawArgs.x = totalWidth; - drawArgs.y = 0; - drawArgs.width = columnWidth; - drawArgs.height = height; - drawArgs.justify = TreeColumn_Justify(treeColumn); - elem = TreeStyle_Identify(&drawArgs, x, y); - if (elem != NULL) - sprintf(buf + strlen(buf), " elem %s", elem); - break; - } - break; - } - totalWidth += columnWidth; - } - - STATIC_FREE(spans, SpanInfo, tree->columnCount); -} - -/* - *---------------------------------------------------------------------- - * - * TreeItem_Identify2 -- - * - * Determine which columns and elements intersect the given - * area. This is used by the [marquee identify] widget command. - * - * Results: - * If the Item is not ReallyVisible() or no columns are visible - * then listObj is untouched. Otherwise the list is appended - * with C {E ...} C {E...}. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -void -TreeItem_Identify2( - TreeCtrl *tree, /* Widget info. */ - TreeItem item_, /* Item token. */ - int x1, int y1, /* Top-left of area to hit-test. */ - int x2, int y2, /* Bottom-right of area to hit-test. */ - Tcl_Obj *listObj /* Initialized list object. */ - ) -{ - Item *self = (Item *) item_; - int indent, columnWidth, totalWidth; - int x, y, w, h; - Column *column; - StyleDrawArgs drawArgs; - TreeColumn treeColumn; - int i, columnIndex; - SpanInfo staticSpans[STATIC_SIZE], *spans = staticSpans; - -#ifdef COLUMN_LOCK - if (Tree_ItemBbox(tree, item_, COLUMN_LOCK_NONE, &x, &y, &w, &h) < 0) -#else - if (Tree_ItemBbox(tree, item_, &x, &y, &w, &h) < 0) -#endif - return; - - STATIC_ALLOC(spans, SpanInfo, tree->columnCount); -#ifdef COLUMN_LOCK - Item_GetSpans(tree, item_, COLUMN_LOCK_NONE, spans); -#else - Item_GetSpans(tree, item_, spans); -#endif - - drawArgs.tree = tree; - drawArgs.drawable = None; - - totalWidth = 0; - for (columnIndex = 0; columnIndex < tree->columnCount; columnIndex++) { - treeColumn = spans[columnIndex].treeColumn; - if (spans[columnIndex].itemColumnIndex != columnIndex) - continue; - if ((tree->columnCountVis == 1) && (treeColumn == tree->columnVis)) - columnWidth = w; - else { - columnWidth = 0; - for (i = columnIndex; i < tree->columnCount; i++) { - if (spans[i].itemColumnIndex != columnIndex) - break; - columnWidth += spans[i].width; - } - } - if (columnWidth <= 0) - continue; - if (treeColumn == tree->columnTree) - indent = TreeItem_Indent(tree, item_); - else - indent = 0; - if ((x2 >= x + totalWidth + indent) && (x1 < x + totalWidth + columnWidth)) { - Tcl_Obj *subListObj = Tcl_NewListObj(0, NULL); - Tcl_ListObjAppendElement(tree->interp, subListObj, - TreeColumn_ToObj(tree, treeColumn)); - column = (Column *) spans[columnIndex].itemColumn; - if ((column != NULL) && (column->style != NULL)) { - drawArgs.state = self->state | column->cstate; - drawArgs.style = column->style; - drawArgs.indent = indent; - drawArgs.x = x + totalWidth; - drawArgs.y = y; - drawArgs.width = columnWidth; - drawArgs.height = h; - drawArgs.justify = TreeColumn_Justify(treeColumn); - TreeStyle_Identify2(&drawArgs, x1, y1, x2, y2, subListObj); - } - Tcl_ListObjAppendElement(tree->interp, listObj, subListObj); - } - totalWidth += columnWidth; - } - - STATIC_FREE(spans, SpanInfo, tree->columnCount); -} - -#endif /* WALK_SPANS */ - #else /* COLUMN_SPAN */ char *TreeItem_Identify(TreeCtrl *tree, TreeItem item_, int x, int y) |