utility function to find the biggest area: BKE_screen_find_big_area(...), was being...
[blender.git] / source / blender / editors / interface / interface_ops.c
index d420b5c24c3c412f293c5de8d22ab95eb7cf2f88..5803054caa71d80d37bbdd62b997b1e95f51bf04 100644 (file)
@@ -43,6 +43,7 @@
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
+#include "BKE_screen.h"
 #include "BKE_global.h"
 #include "BKE_text.h" /* for UI_OT_reports_to_text */
 #include "BKE_report.h"
@@ -577,24 +578,6 @@ void UI_editsource_active_but_test(uiBut *but)
 
 /* editsource operator component */
 
-static ScrArea *biggest_text_view(bContext *C)
-{
-       bScreen *sc= CTX_wm_screen(C);
-       ScrArea *sa, *big= NULL;
-       int size, maxsize= 0;
-
-       for(sa= sc->areabase.first; sa; sa= sa->next) {
-               if(sa->spacetype==SPACE_TEXT) {
-                       size= sa->winx * sa->winy;
-                       if(size > maxsize) {
-                               maxsize= size;
-                               big= sa;
-                       }
-               }
-       }
-       return big;
-}
-
 static int editsource_text_edit(bContext *C, wmOperator *op,
                                 char filepath[240], int line)
 {
@@ -619,7 +602,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
        else {
                /* naughty!, find text area to set, not good behavior
                 * but since this is a dev tool lets allow it - campbell */
-               ScrArea *sa= biggest_text_view(C);
+               ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
                if(sa) {
                        SpaceText *st= sa->spacedata.first;
                        st->text= text;