From 170716ca533b250ffa9ae031096bbef9ad7c2976 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 20 May 2011 05:27:31 +0000 Subject: use BKE_area_find_region_type in place of inline loops (no functional changes). --- source/blender/editors/interface/view2d.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/interface/view2d.c') diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 84cf5af5414..eb522a1d2b8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -44,6 +44,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_screen.h" #include "BKE_global.h" @@ -1959,17 +1960,14 @@ View2D *UI_view2d_fromcontext(const bContext *C) /* same as above, but it returns regionwindow. Utility for pulldowns or buttons */ View2D *UI_view2d_fromcontext_rwin(const bContext *C) { - ScrArea *area= CTX_wm_area(C); + ScrArea *sa= CTX_wm_area(C); ARegion *region= CTX_wm_region(C); - if (area == NULL) return NULL; + if (sa == NULL) return NULL; if (region == NULL) return NULL; if (region->regiontype!=RGN_TYPE_WINDOW) { - ARegion *ar= area->regionbase.first; - for(; ar; ar= ar->next) - if(ar->regiontype==RGN_TYPE_WINDOW) - return &(ar->v2d); - return NULL; + ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); + return ar ? &(ar->v2d) : NULL; } return &(region->v2d); } -- cgit v1.2.3