code cleanup: function naming, use BKE_*type* prefix.
[blender.git] / source / blender / editors / space_logic / space_logic.c
index 69ac68f6f8237cf57eec7ed34da3eb30c3cb7b09..1caf1075ae66d46dfd6db1c2bb88505b7c8e040a 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/editors/space_logic/space_logic.c
+ *  \ingroup splogic
+ */
+
+
 #include <string.h>
 #include <stdio.h>
 
 ARegion *logic_has_buttons_region(ScrArea *sa)
 {
        ARegion *ar, *arnew;
-       
-       for(ar= sa->regionbase.first; ar; ar= ar->next)
-               if(ar->regiontype==RGN_TYPE_UI)
-                       return ar;
+
+       ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+       if (ar) return ar;
        
        /* add subdiv level; after header */
-       for(ar= sa->regionbase.first; ar; ar= ar->next)
-               if(ar->regiontype==RGN_TYPE_HEADER)
-                       break;
-       
+       ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+
        /* is error! */
-       if(ar==NULL) return NULL;
+       if (ar==NULL) return NULL;
        
        arnew= MEM_callocN(sizeof(ARegion), "buttons for image");
        
@@ -119,15 +119,15 @@ static SpaceLink *logic_new(const bContext *UNUSED(C))
        BLI_addtail(&slogic->regionbase, ar);
        ar->regiontype= RGN_TYPE_WINDOW;
 
-       ar->v2d.tot.xmin=  0.0f;
-       ar->v2d.tot.ymin=  0.0f;
-       ar->v2d.tot.xmax= 1280;
-       ar->v2d.tot.ymax= 240.0f;
+       ar->v2d.tot.xmin =  0.0f;
+       ar->v2d.tot.ymin =  0.0f;
+       ar->v2d.tot.xmax = 1280;
+       ar->v2d.tot.ymax = 240.0f;
        
-       ar->v2d.cur.xmin=  0.0f;
-       ar->v2d.cur.ymin=  0.0f;
-       ar->v2d.cur.xmax= 1280.0f;
-       ar->v2d.cur.ymax= 240.0f;
+       ar->v2d.cur.xmin =  0.0f;
+       ar->v2d.cur.ymin =  0.0f;
+       ar->v2d.cur.xmax = 1280.0f;
+       ar->v2d.cur.ymax = 240.0f;
        
        ar->v2d.min[0]= 1.0f;
        ar->v2d.min[1]= 1.0f;
@@ -151,8 +151,8 @@ static void logic_free(SpaceLink *UNUSED(sl))
 {      
 //     Spacelogic *slogic= (SpaceLogic*) sl;
        
-//     if(slogic->gpd)
-// XXX         free_gpencil_data(slogic->gpd);
+//     if (slogic->gpd)
+// XXX         BKE_gpencil_free(slogic->gpd);
        
 }
 
@@ -178,7 +178,7 @@ static void logic_operatortypes(void)
 
 static void logic_keymap(struct wmKeyConfig *keyconf)
 {
-       wmKeyMap *keymap= WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
+       wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
        
        WM_keymap_add_item(keymap, "LOGIC_OT_properties", NKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "LOGIC_OT_links_cut", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -195,12 +195,12 @@ static void logic_refresh(const bContext *UNUSED(C), ScrArea *UNUSED(sa))
 static void logic_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
-       switch(wmn->category) {
+       switch (wmn->category) {
                case NC_LOGIC:
                        ED_region_tag_redraw(ar);
                        break;
                case NC_SCENE:
-                       switch(wmn->data) {
+                       switch (wmn->data) {
                                case ND_FRAME:
                                        ED_region_tag_redraw(ar);
                                        break;
@@ -213,7 +213,7 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn)
                case NC_OBJECT:
                        break;
                case NC_ID:
-                       if(wmn->action == NA_RENAME)
+                       if (wmn->action == NA_RENAME)
                                ED_region_tag_redraw(ar);
                        break;
        }
@@ -236,7 +236,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
        /* own keymaps */
-       keymap= WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
+       keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -275,7 +275,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
        ED_region_panels_init(wm, ar);
        
-       keymap= WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
+       keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
        WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -337,8 +337,6 @@ void ED_spacetype_logic(void)
        art->draw= logic_buttons_area_draw;
        BLI_addhead(&st->regiontypes, art);
 
-       logic_buttons_register(art);
-
        /* regions: header */
        art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
        art->regionid = RGN_TYPE_HEADER;