2.5
authorTon Roosendaal <ton@blender.org>
Fri, 12 Dec 2008 10:18:26 +0000 (10:18 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 12 Dec 2008 10:18:26 +0000 (10:18 +0000)
Resolved cyclic calls for editors.
Now there's a space_api/ module, here you can use functions calling
other editor modules. The functions in the module are only used by
the WindowManager module to initialize space types.

Note for sconzers and MSVC and cmake: the proper linking order for
editors is:

- space_api
- space_xxx
- object / mesh / transform / etc
- interface
- util / datafiles
- screen

source/Makefile
source/blender/editors/Makefile
source/blender/editors/SConscript
source/blender/editors/screen/area.c
source/blender/editors/space_api/Makefile [new file with mode: 0644]
source/blender/editors/space_api/SConscript [new file with mode: 0644]
source/blender/editors/space_api/space.c [moved from source/blender/editors/screen/space.c with 50% similarity]
source/blender/editors/space_api/spacetypes.c [moved from source/blender/editors/screen/spacetypes.c with 97% similarity]
source/blender/editors/space_time/time_header.c

index b975d9bae32b2f41b97d3a69df60c68286fb829b..5c78c27bbc60bb126331d271bb8c4f3673f141d1 100644 (file)
@@ -230,19 +230,19 @@ ifeq ($(WITH_OPENEXR), true)
     COMLIB += $(NAN_OPENEXR_LIBS)
 endif
 
-# silly: libed_screen.a twice :(
+# note: space_api.a in begin of editors, screen.a in end
 PULIB = $(NAN_MOTO)/lib/libmoto.a
 PULIB += $(NAN_ELBEEM)/lib/$(DEBUG_DIR)libelbeem.a
 PULIB += $(OCGDIR)/blender/readblenfile/$(DEBUG_DIR)libreadblenfile.a
-PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
+PULIB += $(OCGDIR)/blender/ed_space/libed_space.a
 PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
 PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
 PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
 PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
 PULIB += $(OCGDIR)/blender/ed_util/libed_util.a
 PULIB += $(OCGDIR)/blender/ed_datafiles/libed_datafiles.a
-PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
 PULIB += $(OCGDIR)/blender/ed_screen/libed_screen.a
+PULIB += $(OCGDIR)/blender/windowmanager/libwindowmanager.a
 PULIB += $(OCGDIR)/blender/python/$(DEBUG_DIR)libpython.a
 PULIB += $(OCGDIR)/blender/makesrna/$(DEBUG_DIR)librna.a
 
index 297255e34699c53c13239ea5f4c083879cc2bd7b..a3cfd02cad45d1fa11b1c2810dd635de28e899a9 100644 (file)
@@ -29,6 +29,6 @@
 # Bounces make to subdirectories.
 
 SOURCEDIR = source/blender/editors
-DIRS = datafiles screen space_outliner space_time space_view3d interface util
+DIRS = datafiles screen space_outliner space_time space_view3d interface util space_api
 
 include nan_subdirs.mk
index 1b24eeb54712015b02f55deceb93f5ce1526cb5f..771815193a591b179b07ed32ba7ac5dbe8dfa19b 100644 (file)
@@ -3,6 +3,7 @@ Import ('env')
 
 
 SConscript(['datafiles/SConscript',
+                       'space_api/SConscript',
                        'util/SConscript',
                        'interface/SConscript',
                        'mesh/SConscript',
index 6fd0e9d6c03414329c67dde12d7ab888bcbdd88c..14a7b51c03d99c3444a4e78416d0233bfd65cb7a 100644 (file)
@@ -500,4 +500,53 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
 #endif
 }
 
+void ED_newspace(ScrArea *sa, int type)
+{
+       if(sa->spacetype != type) {
+               SpaceType *st= BKE_spacetype_from_id(type);
+               SpaceLink *slold= sa->spacedata.first;
+               SpaceLink *sl;
+               
+               sa->spacetype= type;
+               sa->butspacetype= type;
+               
+               /* check previously stored space */
+               for (sl= sa->spacedata.first; sl; sl= sl->next)
+                       if(sl->spacetype==type)
+                               break;
+               
+               /* old spacedata... happened during work on 2.50, remove */
+               if(sl && sl->regionbase.first==NULL) {
+                       st->free(sl);
+                       MEM_freeN(sl);
+                       sl= NULL;
+               }
+               
+               if (sl) {
+                       
+                       /* swap regions */
+                       slold->regionbase= sa->regionbase;
+                       sa->regionbase= sl->regionbase;
+                       sl->regionbase.first= sl->regionbase.last= NULL;
+                       
+                       /* put in front of list */
+                       BLI_remlink(&sa->spacedata, sl);
+                       BLI_addhead(&sa->spacedata, sl);
+               } 
+               else {
+                       /* new space */
+                       if(st) {
+                               sl= st->new();
+                               BLI_addhead(&sa->spacedata, sl);
+                               
+                               /* swap regions */
+                               slold->regionbase= sa->regionbase;
+                               sa->regionbase= sl->regionbase;
+                               sl->regionbase.first= sl->regionbase.last= NULL;
+                       }
+               }
+       }
+       
+}
+
 
diff --git a/source/blender/editors/space_api/Makefile b/source/blender/editors/space_api/Makefile
new file mode 100644 (file)
index 0000000..46f926a
--- /dev/null
@@ -0,0 +1,50 @@
+#
+# $Id: Makefile 14 2002-10-13 15:57:19Z hans $
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version. 
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# 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.
+#
+# The Original Code is Copyright (C) 2007 Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): none yet.
+#
+# ***** END GPL LICENSE BLOCK *****
+#
+# Makes module object directory and bounces make to subdirectories.
+
+LIBNAME = ed_space
+DIR = $(OCGDIR)/blender/$(LIBNAME)
+
+include nan_compile.mk
+
+CFLAGS += $(LEVEL_1_C_WARNINGS)
+
+CPPFLAGS += -I$(NAN_GLEW)/include
+CPPFLAGS += -I$(OPENGL_HEADERS)
+
+# not very neat....
+CPPFLAGS += -I../../blenkernel
+CPPFLAGS += -I../../blenlib
+CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../makesrna
+CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+
+# own include 
+
+CPPFLAGS += -I../include 
diff --git a/source/blender/editors/space_api/SConscript b/source/blender/editors/space_api/SConscript
new file mode 100644 (file)
index 0000000..533c3d8
--- /dev/null
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+Import ('env')
+
+sources = env.Glob('*.c')
+
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna'
+incs += ' ../../windowmanager ../../python ../../makesrna'
+incs += ' #/intern/guardedalloc #/extern/glew/include'
+
+defs = ''
+
+if not env['WITH_BF_PYTHON']:
+    defs += 'DISABLE_PYTHON'
+
+env.BlenderLib ( 'bf_editors_space_api', sources, Split(incs), Split(defs), libtype=['core','intern'], priority=[30, 35] )
similarity index 50%
rename from source/blender/editors/screen/space.c
rename to source/blender/editors/space_api/space.c
index e9287c9976fa426085db6b4614549b8dc66f8726..df844dc527d7b32c242d4267c006c524758b7796 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 
 #include "BKE_global.h"
 #include "BKE_screen.h"
 
-#include "BLO_readfile.h"
-
-#include "WM_api.h"
-
 #include "ED_area.h"
 #include "ED_screen.h"
 
 /* */
 
-void ED_newspace(ScrArea *sa, int type)
-{
-       if(sa->spacetype != type) {
-               SpaceType *st= BKE_spacetype_from_id(type);
-               SpaceLink *slold= sa->spacedata.first;
-               SpaceLink *sl;
-               
-               sa->spacetype= type;
-               sa->butspacetype= type;
-               
-               /* check previously stored space */
-               for (sl= sa->spacedata.first; sl; sl= sl->next)
-                       if(sl->spacetype==type)
-                               break;
-               
-               /* old spacedata... happened during work on 2.50, remove */
-               if(sl && sl->regionbase.first==NULL) {
-                       st->free(sl);
-                       MEM_freeN(sl);
-                       sl= NULL;
-               }
-               
-               if (sl) {
-                       
-                       /* swap regions */
-                       slold->regionbase= sa->regionbase;
-                       sa->regionbase= sl->regionbase;
-                       sl->regionbase.first= sl->regionbase.last= NULL;
-                       
-                       /* put in front of list */
-                       BLI_remlink(&sa->spacedata, sl);
-                       BLI_addhead(&sa->spacedata, sl);
-               } 
-               else {
-                       /* new space */
-                       if(st) {
-                               sl= st->new();
-                               BLI_addhead(&sa->spacedata, sl);
-                               
-                               /* swap regions */
-                               slold->regionbase= sa->regionbase;
-                               sa->regionbase= sl->regionbase;
-                               sl->regionbase.first= sl->regionbase.last= NULL;
-                       }
-               }
-       }
-       
-}
-
 
 
similarity index 97%
rename from source/blender/editors/screen/spacetypes.c
rename to source/blender/editors/space_api/spacetypes.c
index d3d0bfe38d8542268dff966525c674642d4a3193..8997daf3a7fb6a5ec48f0d440251059c8a6a8b16 100644 (file)
@@ -27,6 +27,8 @@
 #include "MEM_guardedalloc.h"
 #include "BLI_blenlib.h"
 
+#include "DNA_windowmanager_types.h"
+
 #include "BKE_global.h"
 #include "BKE_screen.h"
 
 
 #include "BIF_gl.h"
 
-#include "WM_api.h"
-#include "WM_types.h"
-
 #include "ED_screen.h"
 #include "ED_area.h"
 
-#include "screen_intern.h"     /* own module include */
 
 ARegionType *ED_regiontype_from_id(SpaceType *st, int regionid)
 {
index fc3bb73e02197a0c7064d4bb938e9a1c8a4f9ec6..308e49377ada7d894328244de758bd04c802d283 100644 (file)
@@ -386,7 +386,7 @@ void do_time_buttons(bContext *C, void *arg, int event)
        
        switch(event) {
                case B_NEWSPACE:
-                       //ED_newspace(C->area, C->area->butspacetype);  // XXX for ton (breaks compiling, so disabled for now) - Aligorith
+                       ED_newspace(C->area, C->area->butspacetype);
                        WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
                        break;
                case B_REDRAWALL: