From e8c4be18a84456301204f27082aed9bd8933eb77 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 14 Jan 2010 09:56:41 +0000 Subject: [PATCH] Fix [#20029] Text input fields with dropdown list bugs --- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_handlers.c | 5 ++++- source/blender/editors/interface/interface_widgets.c | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7a1cc4f5bad..72502dd018f 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -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; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 705decec70d..75b03e0069d 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -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) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 7b975d17184..575f298b3cd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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)