2.5 file browser

* tweak for autocomplete, only update live if live_update and TAB key is hit. (Brecht, please check if it's ok, otherwise will revert and we'll find another way)
* adding slash at the end of directory to allow for faster autocomplete
* bugfix: directory name buton had wrong length
This commit is contained in:
Andrea Weikert
2009-07-12 09:03:09 +00:00
parent 2940384d9a
commit 184dca5396
3 changed files with 7 additions and 3 deletions

View File

@@ -1438,7 +1438,7 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
int mx, my, changed= 0, inbox=0, retval= WM_UI_HANDLER_CONTINUE;
int mx, my, changed= 0, inbox=0, update= 0, retval= WM_UI_HANDLER_CONTINUE;
switch(event->type) {
case WHEELUPMOUSE:
@@ -1553,6 +1553,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* there is a key conflict here, we can't tab with autocomplete */
if(but->autocomplete_func || data->searchbox) {
changed= ui_textedit_autocomplete(C, but, data);
update= 1; /* do live update for tab key */
retval= WM_UI_HANDLER_BREAK;
}
/* the hotkey here is not well defined, was G.qual so we check all */
@@ -1576,7 +1577,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
if(changed) {
/* never update while typing for now */
if(0/*data->interactive*/) ui_apply_button(C, block, but, data, 1);
if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
if(data->searchbox)

View File

@@ -188,7 +188,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
if (available_w > 0) {
but = uiDefBut(block, TEX, B_FS_DIRNAME, "",
min_x, line1_y, line1_w, btn_h,
params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0,
params->dir, 0.0, (float)FILE_MAXDIR-1, 0, 0,
"File path.");
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
uiDefBut(block, TEX, B_FS_FILENAME, "",

View File

@@ -354,5 +354,8 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
}
}
autocomplete_end(autocpl, str);
if (BLI_exists(str)) {
BLI_add_slash(str);
}
}
}