diff options
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 5d786c1d00b..77524c7e117 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -205,9 +205,10 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select, SpaceFile *sfile= CTX_wm_space_file(C); FileSelect retval = FILE_SELECT_NOTHING; FileSelection sel= file_selection_get(C, rect, fill); /* get the selection */ + const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_ALL; /* flag the files as selected in the filelist */ - filelist_select(sfile->files, &sel, select, SELECTED_FILE, CHECK_ALL); + filelist_select(sfile->files, &sel, select, SELECTED_FILE, check_type); /* Don't act on multiple selected files */ if (sel.first != sel.last) select = 0; @@ -216,7 +217,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select, if ( (sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE)) ) { /* Check last selection, if selected, act on the file or dir */ - if (filelist_is_selected(sfile->files, sel.last, CHECK_ALL)) { + if (filelist_is_selected(sfile->files, sel.last, check_type)) { retval = file_select_do(C, sel.last); } } @@ -301,6 +302,7 @@ void FILE_OT_select_border(wmOperatorType *ot) ot->exec= file_border_select_exec; ot->modal= file_border_select_modal; ot->poll= ED_operator_file_active; + ot->cancel= WM_border_select_cancel; /* rna */ WM_operator_properties_gesture_border(ot, 0); @@ -318,8 +320,8 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event) if(ar->regiontype != RGN_TYPE_WINDOW) return OPERATOR_CANCELLED; - rect.xmin = rect.xmax = event->x - ar->winrct.xmin; - rect.ymin = rect.ymax = event->y - ar->winrct.ymin; + rect.xmin = rect.xmax = event->mval[0]; + rect.ymin = rect.ymax = event->mval[1]; if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin)) return OPERATOR_CANCELLED; @@ -377,8 +379,10 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op)) /* select all only if previously no file was selected */ if (is_selected) { filelist_select(sfile->files, &sel, FILE_SEL_REMOVE, SELECTED_FILE, CHECK_ALL); - } else { - filelist_select(sfile->files, &sel, FILE_SEL_ADD, SELECTED_FILE, CHECK_FILES); + } + else { + const FileCheckType check_type= (sfile->params->flag & FILE_DIRSEL_ONLY) ? CHECK_DIRS : CHECK_FILES; + filelist_select(sfile->files, &sel, FILE_SEL_ADD, SELECTED_FILE, check_type); } ED_area_tag_redraw(sa); return OPERATOR_FINISHED; @@ -1275,7 +1279,7 @@ void FILE_OT_filenum(struct wmOperatorType *ot) ot->poll= ED_operator_file_active; /* <- important, handler is on window level */ /* props */ - RNA_def_int(ot->srna, "increment", 1, 0, 100, "Increment", "", 0,100); + RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100); } static int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) |