diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 16:09:47 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 16:18:25 +0300 |
commit | d1cc340e56691cb82e444289415ede24ba4d2bc0 (patch) | |
tree | fa4dd87f4855bd80a95d176c6c46f010a33c9231 /source/blender/editors/space_file/file_ops.c | |
parent | 7a83b64f7bd39934cf73dcca94598b610e829fb4 (diff) |
Rewrite file region handling for non-editor mode
This makes it so that regions only needed when the file browser is
invoked as an operation (e.g. Ctrl+O rather than a regular editor) are
lazy created then, and removed if the file browser is changed into a
regular editor then (e.g. Ctrl+O over regular file browser editor ->
Cancel).
That should remove some troublesome assumptions and makes versioning
redundant.
It also fixes the issue of an empty execute region at the bottom after
cancelling a file operation invoked from a regular file browser editor.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index b741a255383..fb8c8c5295d 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -2315,58 +2315,10 @@ void FILE_OT_hidedot(struct wmOperatorType *ot) ot->poll = ED_operator_file_active; /* <- important, handler is on window level */ } -ARegion *file_tools_region(ScrArea *sa) -{ - ARegion *ar, *arnew; - - if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOLS)) != NULL) { - return ar; - } - - /* add subdiv level; after header */ - ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER); - - /* is error! */ - if (ar == NULL) { - return NULL; - } - - arnew = MEM_callocN(sizeof(ARegion), "tools for file"); - BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype = RGN_TYPE_TOOLS; - arnew->alignment = RGN_ALIGN_LEFT; - - return arnew; -} - -ARegion *file_tool_props_region(ScrArea *sa) -{ - ARegion *ar, *arnew; - - if ((ar = BKE_area_find_region_type(sa, RGN_TYPE_TOOL_PROPS)) != NULL) { - return ar; - } - - /* add subdiv level; after execute region */ - ar = BKE_area_find_region_type(sa, RGN_TYPE_EXECUTE); - - /* is error! */ - if (ar == NULL) { - return NULL; - } - - arnew = MEM_callocN(sizeof(ARegion), "tool props for file"); - BLI_insertlinkafter(&sa->regionbase, ar, arnew); - arnew->regiontype = RGN_TYPE_TOOL_PROPS; - arnew->alignment = RGN_ALIGN_RIGHT; - - return arnew; -} - static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused)) { ScrArea *sa = CTX_wm_area(C); - ARegion *ar = file_tools_region(sa); + ARegion *ar = file_tools_region_ensure(sa, BKE_area_find_region_type(sa, RGN_TYPE_UI)); if (ar) { ED_region_toggle_hidden(C, ar); |