diff options
author | hobbs2 <hobbs2> | 2006-08-16 00:45:20 (GMT) |
---|---|---|
committer | hobbs2 <hobbs2> | 2006-08-16 00:45:20 (GMT) |
commit | 0487a02c949ad99b81d824e31ee6444a71c19597 (patch) | |
tree | a4770687a1a386168e1ff0aa7bc9e28e1a9d3eb2 /generic | |
parent | 010f205f7179f3277b87979dff6b0dafe76a8e24 (diff) | |
download | tktreectrl-0487a02c949ad99b81d824e31ee6444a71c19597.zip tktreectrl-0487a02c949ad99b81d824e31ee6444a71c19597.tar.gz tktreectrl-0487a02c949ad99b81d824e31ee6444a71c19597.tar.bz2 |
* generic/tkTreeDisplay.c (Tree_Display): Allow Tree_DeselectHidden
* generic/tkTreeItem.c (Item_Configure): to be deferred to next
* generic/tkTreeCtrl.h: redraw by calling
Tree_DInfoChanged(tree, DINFO_REDO_SELECTION). Significantly
improves performance of multiple item visibility changes.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTreeCtrl.h | 3 | ||||
-rw-r--r-- | generic/tkTreeDisplay.c | 10 | ||||
-rw-r--r-- | generic/tkTreeItem.c | 34 |
3 files changed, 31 insertions, 16 deletions
diff --git a/generic/tkTreeCtrl.h b/generic/tkTreeCtrl.h index bd41477..3c2c579 100644 --- a/generic/tkTreeCtrl.h +++ b/generic/tkTreeCtrl.h @@ -7,7 +7,7 @@ * Copyright (c) 2002-2003 Christian Krone * Copyright (c) 2003 ActiveState Corporation * - * RCS: @(#) $Id: tkTreeCtrl.h,v 1.42 2005/09/21 22:40:27 treectrl Exp $ + * RCS: @(#) $Id: tkTreeCtrl.h,v 1.43 2006/08/16 00:45:21 hobbs2 Exp $ */ #include "tkPort.h" @@ -612,6 +612,7 @@ extern void Tree_DrawTiledImage(TreeCtrl *tree, Drawable drawable, Tk_Image imag #define DINFO_UPDATE_SCROLLBAR_Y 0x0800 #define DINFO_REDO_INCREMENTS 0x1000 #define DINFO_REDO_COLUMN_WIDTH 0x2000 +#define DINFO_REDO_SELECTION 0x4000 extern void Tree_DInfoChanged(TreeCtrl *tree, int flags); extern void Tree_TheWorldHasChanged(Tcl_Interp *interp); diff --git a/generic/tkTreeDisplay.c b/generic/tkTreeDisplay.c index 911e2fa..4a3d6e9 100644 --- a/generic/tkTreeDisplay.c +++ b/generic/tkTreeDisplay.c @@ -5,7 +5,7 @@ * * Copyright (c) 2002-2005 Tim Baker * - * RCS: @(#) $Id: tkTreeDisplay.c,v 1.35 2005/09/28 21:56:10 treectrl Exp $ + * RCS: @(#) $Id: tkTreeDisplay.c,v 1.36 2006/08/16 00:45:21 hobbs2 Exp $ */ #include "tkTreeCtrl.h" @@ -3692,6 +3692,14 @@ Tree_Display( dInfo->flags &= ~(DINFO_REDRAW_PENDING); return; } + /* Some change requires selection changes */ + if (dInfo->flags & DINFO_REDO_SELECTION) { +#ifdef SELECTION_VISIBLE + Tree_DeselectHidden(tree); +#endif + dInfo->flags &= ~(DINFO_REDO_SELECTION); + } + /* A column was deleted */ if (dInfo->flags & DINFO_REDO_COLUMN_WIDTH) { TreeColumn treeColumn = tree->columns; diff --git a/generic/tkTreeItem.c b/generic/tkTreeItem.c index 2c1c8a1..87332bc 100644 --- a/generic/tkTreeItem.c +++ b/generic/tkTreeItem.c @@ -5,7 +5,7 @@ * * Copyright (c) 2002-2005 Tim Baker * - * RCS: @(#) $Id: tkTreeItem.c,v 1.56 2006/08/15 02:23:57 hobbs2 Exp $ + * RCS: @(#) $Id: tkTreeItem.c,v 1.57 2006/08/16 00:45:21 hobbs2 Exp $ */ #include "tkTreeCtrl.h" @@ -3740,11 +3740,7 @@ static int Item_Configure( } tree->updateIndex = 1; - Tree_DInfoChanged(tree, DINFO_REDO_RANGES); - -#ifdef SELECTION_VISIBLE - Tree_DeselectHidden(tree); -#endif + Tree_DInfoChanged(tree, DINFO_REDO_RANGES | DINFO_REDO_SELECTION); } return TCL_OK; @@ -5080,9 +5076,11 @@ ItemSortCmd( Tcl_IncrRefCount(obj2); Tcl_DecrRefCount(obj2); - for (j = 0; j < i; j++) - if (sortData.columns[j].sortBy == SORT_COMMAND) + for (j = 0; j < i; j++) { + if (sortData.columns[j].sortBy == SORT_COMMAND) { Tcl_DecrRefCount(sortData.columns[j].command); + } + } return TCL_ERROR; } @@ -5278,17 +5276,22 @@ ItemSortCmd( Tree_DInfoChanged(tree, DINFO_REDO_RANGES); done: - for (i = 0; i < count; i++) - if (sortData.items[i].obj != NULL) + for (i = 0; i < count; i++) { + if (sortData.items[i].obj != NULL) { Tcl_DecrRefCount(sortData.items[i].obj); - for (i = 0; i < sortData.columnCount; i++) - if (sortData.columns[i].sortBy == SORT_COMMAND) + } + } + for (i = 0; i < sortData.columnCount; i++) { + if (sortData.columns[i].sortBy == SORT_COMMAND) { Tcl_DecrRefCount(sortData.columns[i].command); + } + } ckfree((char *) sortData.item1s); ckfree((char *) sortData.items); - if (tree->debug.enable && tree->debug.data) + if (tree->debug.enable && tree->debug.data) { Tree_Debug(tree); + } return result; } @@ -5691,7 +5694,10 @@ doNotify: *---------------------------------------------------------------------- */ -/* FIXME: optimize all calls to this routine */ +/* + * FIXME: optimize all calls to this routine. + * Optionally call Tree_DInfoChanged(tree, DINFO_REDO_SELECTION) instead. + */ void Tree_DeselectHidden( TreeCtrl *tree /* Widget info. */ |