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 */
/* 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);

@ -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;
}

@ -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 */

@ -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

@ -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;