From 942d5dd804d27b67517e566a0d52dc466b3b247f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Oct 2010 00:14:21 +0000 Subject: bugfix [#24158] Object text fields immediately search based on existing content also remove some unused struct members from uiBlock/uiBut. --- source/blender/editors/include/UI_interface.h | 9 +++++---- source/blender/editors/interface/interface.c | 4 ++-- .../blender/editors/interface/interface_handlers.c | 1 + source/blender/editors/interface/interface_intern.h | 20 ++++++++++---------- source/blender/editors/interface/interface_layout.c | 3 ++- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 54a627da2da..4689153c9f5 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -77,17 +77,18 @@ typedef struct uiLayout uiLayout; #define UI_EMBOSST 3 /* Table */ /* uiBlock->direction */ +#define UI_DIRECTION (UI_TOP|UI_DOWN|UI_LEFT|UI_RIGHT) #define UI_TOP 1 #define UI_DOWN 2 #define UI_LEFT 4 #define UI_RIGHT 8 -#define UI_DIRECTION 15 + #define UI_CENTER 16 #define UI_SHIFT_FLIPPED 32 /* uiBlock->autofill (not yet used) */ -#define UI_BLOCK_COLLUMNS 1 -#define UI_BLOCK_ROWS 2 +// #define UI_BLOCK_COLLUMNS 1 +// #define UI_BLOCK_ROWS 2 /* uiBlock->flag (controls) */ #define UI_BLOCK_LOOP 1 @@ -316,7 +317,7 @@ void uiDrawBlock(const struct bContext *C, struct uiBlock *block); uiBlock *uiGetBlock(char *name, struct ARegion *ar); -void uiBlockSetEmboss(uiBlock *block, short dt); +void uiBlockSetEmboss(uiBlock *block, char dt); void uiFreeBlock(const struct bContext *C, uiBlock *block); void uiFreeBlocks(const struct bContext *C, struct ListBase *lb); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b7ec5565d80..f4866237f46 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -937,7 +937,7 @@ void uiComposeLinks(uiBlock *block) void uiBlockSetButLock(uiBlock *block, int val, char *lockstr) { if(val) { - block->lock |= val; + block->lock= val ? 1:0; block->lockstr= lockstr; } } @@ -1947,7 +1947,7 @@ uiBlock *uiGetBlock(char *name, ARegion *ar) return NULL; } -void uiBlockSetEmboss(uiBlock *block, short dt) +void uiBlockSetEmboss(uiBlock *block, char dt) { block->dt= dt; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c789c721aea..6d8c368db3f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1816,6 +1816,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle /* only update when typing for TAB key */ if(update && data->interactive) ui_apply_button(C, block, but, data, 1); else ui_check_but(but); + but->changed= TRUE; if(data->searchbox) ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 3873c5c9092..eb28df54b13 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -206,10 +206,11 @@ struct uiBut { char *tip, *lockstr; BIFIconID icon; - short but_align; /* aligning buttons, horiz/vertical */ - short lock; + char lock; + char dt; + short changed; /* could be made into a single flag */ short modifier_key; - short iconadd, dt; + short iconadd; /* IDPOIN data */ uiIDPoinFuncFP idpoin_func; @@ -296,13 +297,14 @@ struct uiBlock { void *drawextra_arg1; void *drawextra_arg2; - int afterval, flag; - - short direction, dt; - short auto_open, in_use; + int flag; + char direction, dt; + short auto_open; double auto_open_last; - int lock; + char active; // to keep blocks while drawing and free them afterwards + char tooltipdisabled; // to avoid tooltip after click + short lock; char *lockstr; float xofs, yofs; // offset to parent button @@ -314,9 +316,7 @@ struct uiBlock { ListBase saferct; // uiSafetyRct list uiPopupBlockHandle *handle; // handle - int tooltipdisabled; // to avoid tooltip after click - int active; // to keep blocks while drawing and free them afterwards int puphash; // popup menu hash for memory int color_profile; // color profile for correcting linear colors for display diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index e268120fa07..4a9d7a0f6f3 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1109,6 +1109,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop); ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list"); CollItemSearch *cis; + const int skip_filter= !but->changed; /* build a temporary list of relevant items first */ RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) { @@ -1140,7 +1141,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui } if(name) { - if(BLI_strcasestr(name, str)) { + if(skip_filter || BLI_strcasestr(name, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); cis->name = MEM_dupallocN(name); cis->index = i; -- cgit v1.2.3