Fix [#20029] Text input fields with dropdown list bugs
This commit is contained in:
@@ -1360,7 +1360,7 @@ void ui_set_but_val(uiBut *but, double value)
|
||||
|
||||
int ui_get_but_string_max_length(uiBut *but)
|
||||
{
|
||||
if(but->type == TEX)
|
||||
if(ELEM(but->type, TEX, SEARCH_MENU))
|
||||
return but->hardmax;
|
||||
else if(but->type == IDPOIN)
|
||||
return sizeof(((ID*)NULL)->name)-2;
|
||||
|
||||
@@ -1083,8 +1083,11 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
|
||||
/* XXX solve generic */
|
||||
if(but->type==NUM || but->type==NUMSLI)
|
||||
startx += (int)(0.5f*(but->y2 - but->y1));
|
||||
else if(but->type==TEX)
|
||||
else if(ELEM(but->type, TEX, SEARCH_MENU)) {
|
||||
startx += 5;
|
||||
if (but->flag & UI_HAS_ICON)
|
||||
startx += 16;
|
||||
}
|
||||
|
||||
/* XXX does not take zoom level into account */
|
||||
while((BLF_width(origstr+but->ofs) + startx) > x) {
|
||||
|
||||
@@ -804,6 +804,8 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
|
||||
int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
|
||||
int okwidth= rect->xmax-rect->xmin - border;
|
||||
|
||||
if (but->flag & UI_HAS_ICON) okwidth -= 16;
|
||||
|
||||
/* need to set this first */
|
||||
uiStyleFontSet(fstyle);
|
||||
|
||||
@@ -984,7 +986,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
|
||||
if (ELEM4(but->type, NUM, NUMABS, NUMSLI, SLI)) {
|
||||
ui_text_label_rightclip(fstyle, but, rect);
|
||||
}
|
||||
else if (but->type == TEX) {
|
||||
else if (ELEM(but->type, TEX, SEARCH_MENU)) {
|
||||
ui_text_leftclip(fstyle, but, rect);
|
||||
}
|
||||
else but->ofs= 0;
|
||||
@@ -1330,8 +1332,9 @@ static void widget_state(uiWidgetType *wt, int state)
|
||||
|
||||
VECCOPY(wt->wcol.text, wt->wcol.text_sel);
|
||||
|
||||
/* swap for selection - show depressed */
|
||||
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
|
||||
if (!(state & UI_TEXTINPUT))
|
||||
/* swap for selection - show depressed */
|
||||
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
|
||||
}
|
||||
else {
|
||||
if(state & UI_BUT_ANIMATED_KEY)
|
||||
|
||||
Reference in New Issue
Block a user