Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-26 17:23:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-26 17:23:37 +0400
commit2ffa538f7dc3ff756ca71af13e00836e3863b767 (patch)
tree6c49e358904b71a27ebbef0346e47ea13dee351c /source/blender/editors/interface/interface_regions.c
parent2d6402c10c920ddb29a47666f3f7a60642f701ff (diff)
search box width's now scale with DPI setting.
was checking on: [#33294] too small place for material names this helps in some cases but doesn't resolve issue with very long names.
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index c1547593f96..7c099de9c1e 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -826,11 +826,17 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon
return 1;
}
-int uiSearchBoxhHeight(void)
+int uiSearchBoxHeight(void)
{
return SEARCH_ITEMS * UI_UNIT_Y + 2 * MENU_TOP;
}
+int uiSearchBoxWidth(void)
+{
+ /* was hardcoded at 150 */
+ return 9 * UI_UNIT_X;
+}
+
/* ar is the search box itself */
static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
{
@@ -1191,10 +1197,11 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
else {
+ const int searchbox_width = uiSearchBoxWidth();
rect_fl.xmin = but->rect.xmin - 5; /* align text with button */
rect_fl.xmax = but->rect.xmax + 5; /* symmetrical */
rect_fl.ymax = but->rect.ymin;
- rect_fl.ymin = rect_fl.ymax - uiSearchBoxhHeight();
+ rect_fl.ymin = rect_fl.ymax - uiSearchBoxHeight();
ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
@@ -1202,8 +1209,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
BLI_rctf_translate(&rect_fl, ofsx, ofsy);
/* minimal width */
- if (BLI_rctf_size_x(&rect_fl) < 150) {
- rect_fl.xmax = rect_fl.xmin + 150; /* XXX arbitrary */
+ if (BLI_rctf_size_x(&rect_fl) < searchbox_width) {
+ rect_fl.xmax = rect_fl.xmin + searchbox_width;
}
/* copy to int, gets projected if possible too */