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:
authorTon Roosendaal <ton@blender.org>2009-06-10 15:43:21 +0400
committerTon Roosendaal <ton@blender.org>2009-06-10 15:43:21 +0400
commitfba6a9931c81e8cc6a3ea5d3cbd466f2d759c514 (patch)
tree573f2d39036d37cecde991ffba8000a5f845b48d /source/blender/editors/interface/interface_regions.c
parent872767f5c76db75797344b84c056d6cef28248e8 (diff)
2.5
First version of search-based ID browsing. Now only in use for the top bar screen/scene browse. The python buttons will follow. Also made search button colors match the theme colors from menu back. Todos for browse-search: - "Add new" will disappear, and become a separate icon button in the row of widgets (like X, delete). - Drawing the preview icons in menu - Make search menu dynamic, with configurable number of items? And/or multi-collumn... for now it's static - Search menu should popup with last active ID visible and selected
Diffstat (limited to 'source/blender/editors/interface/interface_regions.c')
-rw-r--r--source/blender/editors/interface/interface_regions.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 222c3fe892d..f4b606dac72 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -602,6 +602,8 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
data->active= a+1;
if(cpoin) cpoin[0]= '|';
}
+ if(data->items.totitem==1)
+ data->active= 1;
}
/* validate selected item */
@@ -669,7 +671,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
uiSearchboxData *data;
float aspect= but->block->aspect;
float x1f, x2f, y1f, y2f;
- int x1, x2, y1, y2, winx, winy, ofsx, ofsy;
+ int x1, x2, y1, y2, winx, winy;
/* create area region */
ar= ui_add_temporary_region(CTX_wm_screen(C));
@@ -696,16 +698,27 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->noback= 1;
/* compute position */
- ofsx= (but->block->panel)? but->block->panel->ofsx: 0;
- ofsy= (but->block->panel)? but->block->panel->ofsy: 0;
x1f= but->x1 - 5; /* align text with button */
x2f= but->x2 + 5; /* symmetrical */
- y2f= but->y1;
- y1f= y2f - uiSearchBoxhHeight();
+ if(but->block->flag & UI_BLOCK_LOOP) {
+ /* check if button is lower half */
+ if( but->y2 < (but->block->minx+but->block->maxx)/2 ) {
+ y1f= but->y2;
+ y2f= y1f + uiSearchBoxhHeight();
+ }
+ else {
+ y2f= but->y1;
+ y1f= y2f - uiSearchBoxhHeight();
+ }
+ }
+ else {
+ y2f= but->y1;
+ y1f= y2f - uiSearchBoxhHeight();
+ }
/* minimal width */
- if(x2f - x1f < 180) x2f= x1f+180; // XXX arbitrary
+ if(x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
/* copy to int, gets projected if possible too */
x1= x1f; y1= y1f; x2= x2f; y2= y2f;
@@ -1146,7 +1159,7 @@ uiBlock *ui_block_func_MENU(bContext *C, uiPopupBlockHandle *handle, void *arg_b
rows++;
/* prevent scaling up of pupmenu */
- aspect= but->aspect;
+ aspect= but->block->aspect;
if(aspect < 1.0f)
aspect = 1.0f;
@@ -1169,7 +1182,7 @@ uiBlock *ui_block_func_MENU(bContext *C, uiPopupBlockHandle *handle, void *arg_b
width = (but->x2 - but->x1);
if(width<50)
width=50;
-
+
boxh= MENU_BUTTON_HEIGHT;
height= rows*boxh;