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:
authorJulian Eisel <eiseljulian@gmail.com>2015-07-09 19:40:34 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-07-09 19:40:34 +0300
commitaeeb23efa28dc16e207b168866fe60806f8faa2d (patch)
treeb2aa8a442c4a44e937d9b28d435689319897fe39 /source/blender/editors/space_file/file_ops.c
parent26bd1a766a9c1e71eb55059c80adf959fe884bbc (diff)
File Browser: Improve usage of Enter-key to open files/directories
From a user-POV this makes following changes: * Adds support for using the Enter-key to open directories * Updates the upper text-buttons for file and directory on selection * Last selected file/directory is opened now (in sync with upper text-buttons) * Changes text in open button to "Open Directory" if a directory is selected D1349, Reviewed by @mont29
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 8c9233e3ce5..2146ab39b39 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -206,11 +206,9 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
}
}
else {
- if (file->relname) {
- BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
- }
retval = FILE_SELECT_FILE;
}
+ fileselect_file_set(sfile, selected_idx);
}
return retval;
}
@@ -340,6 +338,7 @@ static int file_border_select_modal(bContext *C, wmOperator *op, const wmEvent *
else {
params->highlight_file = -1;
params->sel_first = params->sel_last = -1;
+ fileselect_file_set(sfile, params->active_file);
file_deselect_all(sfile, FILE_SEL_HIGHLIGHTED);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
@@ -487,7 +486,7 @@ static bool file_walk_select_selection_set(
* selected and either other_side isn't selected/found or we use fill */
deselect = (fill || other_site == -1 || !filelist_is_selected(files, other_site, FILE_SEL_SELECTED));
- /* don't change active here since we either want to deselect active or we want to
+ /* don't change highlight_file here since we either want to deselect active or we want to
* walk through a block of selected files without selecting/deselecting anything */
params->active_file = active_new;
/* but we want to change active if we use fill (needed to get correct selection bounds) */
@@ -549,6 +548,7 @@ static bool file_walk_select_selection_set(
}
BLI_assert(IN_RANGE(active, 0, numfiles));
+ fileselect_file_set(sfile, params->active_file);
/* selection changed */
return true;
@@ -1243,14 +1243,28 @@ bool file_draw_check_exists(SpaceFile *sfile)
return false;
}
-/* sends events now, so things get handled on windowqueue level */
int file_exec(bContext *C, wmOperator *exec_op)
{
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C);
+ const struct direntry *file = filelist_file(sfile->files, sfile->params->active_file);
char filepath[FILE_MAX];
-
- if (sfile->op) {
+
+ if (!file || !sfile->params->file[0])
+ return OPERATOR_CANCELLED;
+
+ BLI_assert(STREQ(file->relname, sfile->params->file));
+
+ /* directory change */
+ if (S_ISDIR(file->type)) {
+ BLI_cleanup_dir(G.main->name, sfile->params->dir);
+ strcat(sfile->params->dir, sfile->params->file);
+ BLI_add_slash(sfile->params->dir);
+
+ ED_file_change_dir(C, false);
+ }
+ /* opening file - sends events now, so things get handled on windowqueue level */
+ else if (sfile->op) {
wmOperator *op = sfile->op;
/* when used as a macro, for doubleclick,
@@ -1283,7 +1297,7 @@ int file_exec(bContext *C, wmOperator *exec_op)
WM_event_fileselect_event(wm, op, EVT_FILESELECT_EXEC);
}
-
+
return OPERATOR_FINISHED;
}