2.5 filebrowser
authorAndrea Weikert <elubie@gmx.net>
Sun, 13 Sep 2009 09:41:00 +0000 (09:41 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sun, 13 Sep 2009 09:41:00 +0000 (09:41 +0000)
* Fix for space init when loading with pupmenu (without operator) - parameters now get reset
* experimental: made new director operator jump directly into renaming

source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/space_file.c
source/blender/makesdna/DNA_space_types.h

index e51fd421c8cd5668705a9a59997fa884f378fa9a..9705a36fc754603189174a04bbe6632befba87f8 100644 (file)
@@ -705,7 +705,9 @@ int file_directory_new_exec(bContext *C, wmOperator *unused)
                        BLI_join_dirfile(tmpstr, tmpstr, tmpdir);
                }
                BLI_recurdir_fileops(tmpstr);
-               if (!BLI_exists(tmpstr)) {
+               if (BLI_exists(tmpstr)) {
+                       BLI_strncpy(sfile->params->renamefile, tmpdir, FILE_MAXFILE);
+               } else {
                        filelist_free(sfile->files);
                        filelist_parent(sfile->files);
                        BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), FILE_MAX);
index f226b3de2602bcbfdc6ac5556b858fee65003caa..085eecd2a7ddbf604b70f8dce669fd9bd5346722 100644 (file)
@@ -154,8 +154,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                if (params->filter != 0)
                        params->flag |= FILE_FILTER;
 
+               params->flag |= FILE_HIDE_DOT;
+
                if (params->type == FILE_LOADLIB) {
-                       params->flag |= FILE_HIDE_DOT;
                        params->flag |= RNA_boolean_get(op->ptr, "link") ? FILE_LINK : 0;
                        params->flag |= RNA_boolean_get(op->ptr, "autoselect") ? FILE_AUTOSELECT : 0;
                        params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
index bceeec1cb5517e035e13f4e22791c096d8b6a5b7..47839ea03421a7a7fa4ad5ca78b2724a996898db 100644 (file)
@@ -45,6 +45,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 #include "BLI_rand.h"
+#include "BLI_storage_types.h"
 
 #include "BKE_colortools.h"
 #include "BKE_context.h"
@@ -154,6 +155,9 @@ static void file_free(SpaceLink *sl)
 /* spacetype; init callback, area size changes, screen set, etc */
 static void file_init(struct wmWindowManager *wm, ScrArea *sa)
 {
+       SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
+       MEM_freeN(sfile->params);
+       sfile->params = 0;
        printf("file_init\n");
 }
 
@@ -203,7 +207,17 @@ static void file_refresh(const bContext *C, ScrArea *sa)
                filelist_readdir(sfile->files);
        }
        if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort);             
-
+       
+       if (params->renamefile[0] != '\0') {
+               int idx = filelist_find(sfile->files, params->renamefile);
+               if (idx >= 0) {
+                       struct direntry *file= filelist_file(sfile->files, idx);
+                       if (file) {
+                               file->flags |= EDITING;
+                       }
+               }
+               params->renamefile[0] = '\0';
+       }
        if (sfile->layout) sfile->layout->dirty= 1;
 
 }
index 97ddb291136b472753418e459572c63f1c66ea98..806d12815b5570df98d00a406a86bd9598911113 100644 (file)
@@ -153,6 +153,7 @@ typedef struct FileSelectParams {
        char title[24]; /* title, also used for the text of the execute button */
        char dir[240]; /* directory */
        char file[80]; /* file */
+       char renamefile[80];
 
        short type; /* XXXXX for now store type here, should be moved to the operator */
        short flag; /* settings for filter, hiding dots files,...  */