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
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-02-28 16:33:31 +0300
committerJacques Lucke <jacques@blender.org>2020-02-28 16:34:56 +0300
commite8ab0137f8766a8db82b051cec84c1bdc7b6ce19 (patch)
tree5bce8a8dec2dc37601f3bdedb4792a9802c015e8 /source
parente0f41d32c972db36e86289136b517f54db92de06 (diff)
File Browser: Add Ctrl+F shortcut to activate filter textbox
Reviewers: Severin, brecht Differential Revision: https://developer.blender.org/D6941
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/interface/interface_handlers.c3
-rw-r--r--source/blender/editors/space_file/file_intern.h1
-rw-r--r--source/blender/editors/space_file/file_ops.c22
-rw-r--r--source/blender/editors/space_file/space_file.c1
4 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7332f3ee776..8fc73327432 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -8432,7 +8432,10 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
event.customdata = but;
event.customdatafree = false;
+ ARegion *old_ar = CTX_wm_region(C);
+ CTX_wm_region_set(C, ar);
ui_do_button(C, but->block, but, &event);
+ CTX_wm_region_set(C, old_ar);
}
/**
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 30dff1362fa..730df53813c 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -80,6 +80,7 @@ void FILE_OT_delete(struct wmOperatorType *ot);
void FILE_OT_rename(struct wmOperatorType *ot);
void FILE_OT_smoothscroll(struct wmOperatorType *ot);
void FILE_OT_filepath_drop(struct wmOperatorType *ot);
+void FILE_OT_start_filter(struct wmOperatorType *ot);
int file_exec(bContext *C, struct wmOperator *exec_op);
int file_cancel_exec(bContext *C, struct wmOperator *unused);
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 61eb4db8300..32c5cdde0a3 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -2542,6 +2542,28 @@ void FILE_OT_delete(struct wmOperatorType *ot)
ot->poll = file_delete_poll; /* <- important, handler is on window level */
}
+static int file_start_filter_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ SpaceFile *sf = CTX_wm_space_file(C);
+
+ UI_textbutton_activate_rna(C, ar, sf->params, "filter_search");
+ return OPERATOR_FINISHED;
+}
+
+void FILE_OT_start_filter(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Filter";
+ ot->description = "Start entering filter text";
+ ot->idname = "FILE_OT_start_filter";
+
+ /* api callbacks */
+ ot->exec = file_start_filter_exec;
+ ot->poll = ED_operator_file_active;
+}
+
void ED_operatormacros_file(void)
{
// wmOperatorType *ot;
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 17f5a5f7fa0..79ccbf6542f 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -541,6 +541,7 @@ static void file_operatortypes(void)
WM_operatortype_append(FILE_OT_rename);
WM_operatortype_append(FILE_OT_smoothscroll);
WM_operatortype_append(FILE_OT_filepath_drop);
+ WM_operatortype_append(FILE_OT_start_filter);
}
/* NOTE: do not add .blend file reading on this level */