merge with/from trunk at r35190
[blender.git] / source / blender / editors / space_api / spacetypes.c
index 5a55c5fb7172e2881185679095a0dea8ad986506..db857d4be9f720b3df113572e499620cde660be0 100644 (file)
@@ -1,5 +1,5 @@
-/**
- * $Id: spacetypes.c
+/*
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) Blender Foundation, 2008
  *
 #include <stdlib.h>
 
 #include "MEM_guardedalloc.h"
+
 #include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 
 #include "DNA_object_types.h"
-#include "DNA_scene_types.h"
 #include "DNA_windowmanager_types.h"
 
+
 #include "BKE_context.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
+
+#include "bmesh.h"
 
 #include "UI_interface.h"
 #include "UI_view2d.h"
 
-#include "BIF_gl.h"
 
 #include "ED_anim_api.h"
 #include "ED_armature.h"
 #include "ED_curve.h"
+#include "ED_fileselect.h"
+#include "ED_gpencil.h"
 #include "ED_markers.h"
 #include "ED_mesh.h"
+#include "ED_node.h"
 #include "ED_object.h"
-#include "ED_particle.h"
 #include "ED_physics.h"
+#include "ED_render.h"
 #include "ED_screen.h"
 #include "ED_sculpt.h"
 #include "ED_space_api.h"
+#include "ED_sound.h"
 #include "ED_uvedit.h"
+#include "ED_mball.h"
+#include "ED_logic.h"
 
 /* only call once on startup, storage is global in BKE kernel listbase */
 void ED_spacetypes_init(void)
@@ -76,70 +86,93 @@ void ED_spacetypes_init(void)
        ED_spacetype_sequencer();
        ED_spacetype_logic();
        ED_spacetype_console();
+       ED_spacetype_userpref();
 //     ...
        
        /* register operator types for screen and all spaces */
        ED_operatortypes_screen();
        ED_operatortypes_anim();
-       ED_operatortypes_animchannels(); // XXX have this as part of anim() ones instead?
+       ED_operatortypes_animchannels();
+       ED_operatortypes_gpencil();
        ED_operatortypes_object();
        ED_operatortypes_mesh();
        ED_operatortypes_sculpt();
        ED_operatortypes_uvedit();
        ED_operatortypes_paint();
-       ED_operatortypes_particle();
+       ED_operatortypes_physics();
        ED_operatortypes_curve();
        ED_operatortypes_armature();
        ED_operatortypes_marker();
-       ED_operatortypes_pointcache();
-       ED_operatortypes_fluid();
+       ED_operatortypes_metaball();
+       ED_operatortypes_sound();
+       ED_operatortypes_render();
+       ED_operatortypes_logic();
        
-       ui_view2d_operatortypes();
+       UI_view2d_operatortypes();
+       UI_buttons_operatortypes();
        
+       /* register operators */
+       spacetypes = BKE_spacetypes_list();
+       for(type=spacetypes->first; type; type=type->next) {
+               if(type->operatortypes)
+                       type->operatortypes();
+       }
+
+       /* Macros's must go last since they reference other operators
+        * maybe we'll need to have them go after python operators too? */
+       ED_operatormacros_armature();
+       ED_operatormacros_mesh();
+       ED_operatormacros_node();
+       ED_operatormacros_object();
+       ED_operatormacros_file();
+
+       /* register dropboxes (can use macros) */
        spacetypes = BKE_spacetypes_list();
-       for(type=spacetypes->first; type; type=type->next)
-               type->operatortypes();
+       for(type=spacetypes->first; type; type=type->next) {
+               if(type->dropboxes)
+                       type->dropboxes();
+       }
+       
 }
 
 /* called in wm.c */
 /* keymap definitions are registered only once per WM initialize, usually on file read,
    using the keymap the actual areas/regions add the handlers */
-void ED_spacetypes_keymap(wmWindowManager *wm)
+void ED_spacetypes_keymap(wmKeyConfig *keyconf)
 {
        const ListBase *spacetypes;
        SpaceType *stype;
        ARegionType *atype;
 
-       ED_keymap_screen(wm);
-       ED_keymap_anim(wm);
-       ED_keymap_animchannels(wm);
-       ED_keymap_object(wm);
-       ED_keymap_mesh(wm);
-       ED_keymap_uvedit(wm);
-       ED_keymap_curve(wm);
-       ED_keymap_armature(wm);
-       ED_keymap_particle(wm);
-       ED_marker_keymap(wm);
-
-       UI_view2d_keymap(wm);
+       ED_keymap_screen(keyconf);
+       ED_keymap_anim(keyconf);
+       ED_keymap_animchannels(keyconf);
+       ED_keymap_gpencil(keyconf);
+       ED_keymap_object(keyconf); /* defines lattice also */
+       ED_keymap_mesh(keyconf);
+       ED_keymap_uvedit(keyconf);
+       ED_keymap_curve(keyconf);
+       ED_keymap_armature(keyconf);
+       ED_keymap_physics(keyconf);
+       ED_keymap_metaball(keyconf);
+       ED_keymap_paint(keyconf);
+       ED_marker_keymap(keyconf);
+
+       UI_view2d_keymap(keyconf);
 
        spacetypes = BKE_spacetypes_list();
        for(stype=spacetypes->first; stype; stype=stype->next) {
                if(stype->keymap)
-                       stype->keymap(wm);
+                       stype->keymap(keyconf);
                for(atype=stype->regiontypes.first; atype; atype=atype->next) {
                        if(atype->keymap)
-                               atype->keymap(wm);
+                               atype->keymap(keyconf);
                }
        }
 }
 
 /* ********************** custom drawcall api ***************** */
 
-/* type */
-#define REGION_DRAW_PRE                1
-#define REGION_DRAW_POST       0
-
 typedef struct RegionDrawCB {
        struct RegionDrawCB *next, *prev;
        
@@ -177,6 +210,11 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
        }
 }
 
+void *ED_region_draw_cb_customdata(void *handle)
+{
+       return ((RegionDrawCB *)handle)->customdata;
+}
+
 void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
 {
        RegionDrawCB *rdc;
@@ -192,19 +230,19 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
 /* ********************* space template *********************** */
 
 /* allocate and init some vars */
-static SpaceLink *xxx_new(const bContext *C)
+static SpaceLink *xxx_new(const bContext *UNUSED(C))
 {
        return NULL;
 }
 
 /* not spacelink itself */
-static void xxx_free(SpaceLink *sl)
+static void xxx_free(SpaceLink *UNUSED(sl))
 {
 
 }
 
 /* spacetype; init callback for usage, should be redoable */
-static void xxx_init(wmWindowManager *wm, ScrArea *sa)
+static void xxx_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 {
        
        /* link area to SpaceXXX struct */
@@ -214,7 +252,7 @@ static void xxx_init(wmWindowManager *wm, ScrArea *sa)
        /* add types to regions */
 }
 
-static SpaceLink *xxx_duplicate(SpaceLink *sl)
+static SpaceLink *xxx_duplicate(SpaceLink *UNUSED(sl))
 {
        
        return NULL;
@@ -225,13 +263,13 @@ static void xxx_operatortypes(void)
        /* register operator types for this space */
 }
 
-static void xxx_keymap(wmWindowManager *wm)
+static void xxx_keymap(wmKeyConfig *UNUSED(keyconf))
 {
        /* add default items to keymap */
 }
 
 /* only called once, from screen/spacetypes.c */
-void ED_spacetype_xxx(void)
+static void ED_spacetype_xxx(void)
 {
        static SpaceType st;