Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-12-12 13:18:26 +0300
committerTon Roosendaal <ton@blender.org>2008-12-12 13:18:26 +0300
commit7f3a34d16c9eeda100a6b84d8374d848074702a2 (patch)
tree65d585aeae7cbc3868ae4e829cf6e4d88dd7e2d9 /source/blender/editors/screen/area.c
parent6f6eee09238a751c42aad9df84d7f8b2f131841c (diff)
2.5
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
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 6fd0e9d6c03..14a7b51c03d 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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;
+ }
+ }
+ }
+
+}
+