2.5 file browser
authorAndrea Weikert <elubie@gmx.net>
Sun, 12 Jul 2009 09:03:09 +0000 (09:03 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sun, 12 Jul 2009 09:03:09 +0000 (09:03 +0000)
* 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

source/blender/editors/interface/interface_handlers.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/filesel.c

index 0693a771ffa9ab5c5aa9ce2d122d70a57d2d559b..0fbfeffba0d252e4554e6272a7dd4b718cebf3d4 100644 (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)
index e107bcecb3b4b9073c1e1cca70a6e39771e5ec27..339ebe27fcd58490b8496db50b5e7bface2f21d9 100644 (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, "",
index d34eb29a78d04d47de407fd24a93012dedf3d85e..c81dab454f811f2784f35c456f2f8191e55afe05 100644 (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);
+               }
        }
 }
\ No newline at end of file