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:
authorAndrea Weikert <elubie@gmx.net>2010-04-19 23:29:40 +0400
committerAndrea Weikert <elubie@gmx.net>2010-04-19 23:29:40 +0400
commit4a993039674403815ab144cbaad80c805e9c36b4 (patch)
tree74f2649ad4fe62e66c0e5b29d99143148f31f654 /source/blender/editors/space_file/file_ops.c
parent37a1297a551ce0a78c76fb198f478590a3ddab83 (diff)
== file browser ==
Select from last selection. This new setting allows to select all files from the last selected to the current. (Works like SHIFT+SELECT in Windows file browser) Keymap is LEFTMOUSE+ALT for now since LEFTMOUSE+CTRL is already used for renaming (like in outliner)
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index f1d3702160f..85b3cee354b 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -121,7 +121,7 @@ static void clamp_to_filelist(int numfiles, int *first_file, int *last_file)
}
}
-static FileSelect file_select(bContext* C, const rcti* rect, short selecting, short toggle_one)
+static FileSelect file_select(bContext* C, const rcti* rect, short selecting, short toggle_one, short fill)
{
ARegion *ar= CTX_wm_region(C);
SpaceFile *sfile= CTX_wm_space_file(C);
@@ -141,6 +141,19 @@ static FileSelect file_select(bContext* C, const rcti* rect, short selecting, sh
clamp_to_filelist(numfiles, &first_file, &last_file);
+ if (fill && (last_file >= 0) && (last_file < numfiles) ) {
+ int f= last_file;
+ while (f >= 0) {
+ struct direntry* file = filelist_file(sfile->files, f);
+ if (file->flags & ACTIVEFILE)
+ break;
+ f--;
+ }
+ if (f >= 0) {
+ first_file = f+1;
+ }
+ }
+
/* select all valid files between first and last indicated */
if ( (first_file >= 0) && (first_file < numfiles) && (last_file >= 0) && (last_file < numfiles) ) {
for (act_file = first_file; act_file <= last_file; act_file++) {
@@ -213,7 +226,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
- if (FILE_SELECT_DIR == file_select(C, &rect, selecting, 0)) {
+ if (FILE_SELECT_DIR == file_select(C, &rect, selecting, 0, 0)) {
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
} else {
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
@@ -245,6 +258,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
short val;
rcti rect;
int extend = RNA_boolean_get(op->ptr, "extend");
+ int fill = RNA_boolean_get(op->ptr, "fill");
if(ar->regiontype != RGN_TYPE_WINDOW)
return OPERATOR_CANCELLED;
@@ -259,7 +273,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* single select, deselect all selected first */
if (!extend) file_deselect_all(sfile);
- if (FILE_SELECT_DIR == file_select(C, &rect, 1, extend ))
+ if (FILE_SELECT_DIR == file_select(C, &rect, 1, extend, fill ))
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
else
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
@@ -283,6 +297,7 @@ void FILE_OT_select(wmOperatorType *ot)
/* rna */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first.");
+ RNA_def_boolean(ot->srna, "fill", 0, "Fill", "Select everything beginning with the last selection.");
}
static int file_select_all_exec(bContext *C, wmOperator *op)
@@ -657,7 +672,9 @@ void FILE_OT_parent(struct wmOperatorType *ot)
int file_refresh_exec(bContext *C, wmOperator *unused)
{
- file_change_dir(C, 1);
+ SpaceFile *sfile= CTX_wm_space_file(C);
+
+ ED_fileselect_clear(C, sfile);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);