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>2011-03-20 13:22:51 +0300
committerAndrea Weikert <elubie@gmx.net>2011-03-20 13:22:51 +0300
commit5325f3b2e989a3b94e2d9450c574e4610d2005d8 (patch)
tree83275fe6127348ed6a10616e0dc84505bccc0526 /source/blender/editors/space_file/filelist.c
parent5442e725a5b534b8d843c9cd3c451eee167355b3 (diff)
== file browser ==
Patch from Alexander Kuznetsov: Toggle selection rather than just extending. Implements behaviour that unintendedly was available with previously using macro operator for selection. This was removed and now the functionality is properly implemented. Patch accepted with minor changes: 1. Used enum rather than #defines and added value for removing from selection (deselect) 2. Moved if (select) outside file_select_do and improved check for whether last file in selection is actually selected. (Necessary since toggle can deselect and toggle select should still make file active) 3. Additionally fixed check in file_select_invoke to be consistent with border select.
Diffstat (limited to 'source/blender/editors/space_file/filelist.c')
-rw-r--r--source/blender/editors/space_file/filelist.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 5fb64b2f2bc..3c76b815a80 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -926,7 +926,7 @@ void filelist_swapselect(struct FileList* filelist)
}
}
-void filelist_select(struct FileList* filelist, FileSelection* sel, short select, unsigned int flag)
+void filelist_select(struct FileList* filelist, FileSelection* sel, FileSelType select, unsigned int flag)
{
/* select all valid files between first and last indicated */
if ( (sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered) ) {
@@ -934,10 +934,17 @@ void filelist_select(struct FileList* filelist, FileSelection* sel, short select
for (current_file = sel->first; current_file <= sel->last; current_file++) {
struct direntry* file = filelist_file(filelist, current_file);
- if (select)
- file->flags |= flag;
- else
- file->flags &= ~flag;
+ switch (select) {
+ case FILE_SEL_REMOVE:
+ file->flags &= ~flag;
+ break;
+ case FILE_SEL_ADD:
+ file->flags |= flag;
+ break;
+ case FILE_SEL_TOGGLE:
+ file->flags ^= flag;
+ break;
+ }
}
}
}