bugfix [#24158] Object text fields immediately search based on existing content

also remove some unused struct members from uiBlock/uiBut.
This commit is contained in:
Campbell Barton 2010-10-07 00:14:21 +00:00
parent 8bb75bb5b6
commit 942d5dd804
5 changed files with 20 additions and 17 deletions

@ -77,17 +77,18 @@ typedef struct uiLayout uiLayout;
#define UI_EMBOSST 3 /* Table */ #define UI_EMBOSST 3 /* Table */
/* uiBlock->direction */ /* uiBlock->direction */
#define UI_DIRECTION (UI_TOP|UI_DOWN|UI_LEFT|UI_RIGHT)
#define UI_TOP 1 #define UI_TOP 1
#define UI_DOWN 2 #define UI_DOWN 2
#define UI_LEFT 4 #define UI_LEFT 4
#define UI_RIGHT 8 #define UI_RIGHT 8
#define UI_DIRECTION 15
#define UI_CENTER 16 #define UI_CENTER 16
#define UI_SHIFT_FLIPPED 32 #define UI_SHIFT_FLIPPED 32
/* uiBlock->autofill (not yet used) */ /* uiBlock->autofill (not yet used) */
#define UI_BLOCK_COLLUMNS 1 // #define UI_BLOCK_COLLUMNS 1
#define UI_BLOCK_ROWS 2 // #define UI_BLOCK_ROWS 2
/* uiBlock->flag (controls) */ /* uiBlock->flag (controls) */
#define UI_BLOCK_LOOP 1 #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); 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 uiFreeBlock(const struct bContext *C, uiBlock *block);
void uiFreeBlocks(const struct bContext *C, struct ListBase *lb); void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);

@ -937,7 +937,7 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr) void uiBlockSetButLock(uiBlock *block, int val, char *lockstr)
{ {
if(val) { if(val) {
block->lock |= val; block->lock= val ? 1:0;
block->lockstr= lockstr; block->lockstr= lockstr;
} }
} }
@ -1947,7 +1947,7 @@ uiBlock *uiGetBlock(char *name, ARegion *ar)
return NULL; return NULL;
} }
void uiBlockSetEmboss(uiBlock *block, short dt) void uiBlockSetEmboss(uiBlock *block, char dt)
{ {
block->dt= dt; block->dt= dt;
} }

@ -1816,6 +1816,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* only update when typing for TAB key */ /* only update when typing for TAB key */
if(update && data->interactive) ui_apply_button(C, block, but, data, 1); if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but); else ui_check_but(but);
but->changed= TRUE;
if(data->searchbox) if(data->searchbox)
ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */ ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */

@ -206,10 +206,11 @@ struct uiBut {
char *tip, *lockstr; char *tip, *lockstr;
BIFIconID icon; BIFIconID icon;
short but_align; /* aligning buttons, horiz/vertical */ char lock;
short lock; char dt;
short changed; /* could be made into a single flag */
short modifier_key; short modifier_key;
short iconadd, dt; short iconadd;
/* IDPOIN data */ /* IDPOIN data */
uiIDPoinFuncFP idpoin_func; uiIDPoinFuncFP idpoin_func;
@ -296,13 +297,14 @@ struct uiBlock {
void *drawextra_arg1; void *drawextra_arg1;
void *drawextra_arg2; void *drawextra_arg2;
int afterval, flag; int flag;
char direction, dt;
short direction, dt; short auto_open;
short auto_open, in_use;
double auto_open_last; 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; char *lockstr;
float xofs, yofs; // offset to parent button float xofs, yofs; // offset to parent button
@ -314,9 +316,7 @@ struct uiBlock {
ListBase saferct; // uiSafetyRct list ListBase saferct; // uiSafetyRct list
uiPopupBlockHandle *handle; // handle 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 puphash; // popup menu hash for memory
int color_profile; // color profile for correcting linear colors for display int color_profile; // color profile for correcting linear colors for display

@ -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); int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop);
ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list"); ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list");
CollItemSearch *cis; CollItemSearch *cis;
const int skip_filter= !but->changed;
/* build a temporary list of relevant items first */ /* build a temporary list of relevant items first */
RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) { 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(name) {
if(BLI_strcasestr(name, str)) { if(skip_filter || BLI_strcasestr(name, str)) {
cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
cis->name = MEM_dupallocN(name); cis->name = MEM_dupallocN(name);
cis->index = i; cis->index = i;