Cleanup: Add/use utility to remove regions
This commit is contained in:
@@ -66,6 +66,7 @@ void ED_region_do_listen(struct wmWindow *win,
|
|||||||
void ED_region_do_layout(struct bContext *C, struct ARegion *ar);
|
void ED_region_do_layout(struct bContext *C, struct ARegion *ar);
|
||||||
void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
|
void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
|
||||||
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
||||||
|
void ED_region_remove(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
|
||||||
void ED_region_pixelspace(struct ARegion *ar);
|
void ED_region_pixelspace(struct ARegion *ar);
|
||||||
void ED_region_update_rect(struct ARegion *ar);
|
void ED_region_update_rect(struct ARegion *ar);
|
||||||
void ED_region_init(struct ARegion *ar);
|
void ED_region_init(struct ARegion *ar);
|
||||||
|
|||||||
@@ -519,6 +519,17 @@ void ED_screen_ensure_updated(wmWindowManager *wm, wmWindow *win, bScreen *scree
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility to exit and free an area-region. Screen level regions (menus/popups) need to be treated
|
||||||
|
* slightly differently, see #ui_region_temp_remove().
|
||||||
|
*/
|
||||||
|
void ED_region_remove(bContext *C, ScrArea *sa, ARegion *ar)
|
||||||
|
{
|
||||||
|
ED_region_exit(C, ar);
|
||||||
|
BKE_area_region_free(sa->type, ar);
|
||||||
|
BLI_freelinkN(&sa->regionbase, ar);
|
||||||
|
}
|
||||||
|
|
||||||
/* *********** exit calls are for closing running stuff ******** */
|
/* *********** exit calls are for closing running stuff ******** */
|
||||||
|
|
||||||
void ED_region_exit(bContext *C, ARegion *ar)
|
void ED_region_exit(bContext *C, ARegion *ar)
|
||||||
|
|||||||
@@ -3848,10 +3848,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
|
|||||||
for (ar = sa->regionbase.first; ar; ar = arn) {
|
for (ar = sa->regionbase.first; ar; ar = arn) {
|
||||||
arn = ar->next;
|
arn = ar->next;
|
||||||
if (ar->alignment == RGN_ALIGN_QSPLIT) {
|
if (ar->alignment == RGN_ALIGN_QSPLIT) {
|
||||||
ED_region_exit(C, ar);
|
ED_region_remove(C, sa, ar);
|
||||||
BKE_area_region_free(sa->type, ar);
|
|
||||||
BLI_remlink(&sa->regionbase, ar);
|
|
||||||
MEM_freeN(ar);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ED_area_tag_redraw(sa);
|
ED_area_tag_redraw(sa);
|
||||||
|
|||||||
@@ -307,11 +307,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
|
|||||||
}
|
}
|
||||||
/* If there's _no_ file-operation, ensure we _don't_ have the option region */
|
/* If there's _no_ file-operation, ensure we _don't_ have the option region */
|
||||||
else if (sa && (sfile->op == NULL) && (region_tool_props != NULL)) {
|
else if (sa && (sfile->op == NULL) && (region_tool_props != NULL)) {
|
||||||
/* Remove TOOL_PROPS region. */
|
ED_region_remove(C, sa, region_tool_props);
|
||||||
ED_region_exit((bContext *)C, region_tool_props);
|
|
||||||
BKE_area_region_free(sa->type, region_tool_props);
|
|
||||||
BLI_remlink(&sa->regionbase, region_tool_props);
|
|
||||||
MEM_freeN(region_tool_props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ED_area_tag_redraw(sa);
|
ED_area_tag_redraw(sa);
|
||||||
|
|||||||
Reference in New Issue
Block a user