4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) Blender Foundation, 2008
22 * ***** END GPL/BL DUAL LICENSE BLOCK *****
27 #include "MEM_guardedalloc.h"
28 #include "BLI_blenlib.h"
30 #include "DNA_windowmanager_types.h"
32 #include "BKE_context.h"
33 #include "BKE_screen.h"
35 #include "UI_interface.h"
36 #include "UI_view2d.h"
40 #include "ED_screen.h"
41 #include "ED_space_api.h"
42 #include "ED_anim_api.h"
45 ARegionType *ED_regiontype_from_id(SpaceType *st, int regionid)
49 for(art= st->regiontypes.first; art; art= art->next)
50 if(art->regionid==regionid)
53 printf("Error, region type missing in %s\n", st->name);
54 return st->regiontypes.first;
58 /* only call once on startup, storage is global in BKE kernel listbase */
59 void ED_spacetypes_init(void)
61 const ListBase *spacetypes;
64 /* create space types */
65 ED_spacetype_outliner();
67 ED_spacetype_view3d();
71 ED_spacetype_buttons();
75 ED_spacetype_action();
77 ED_spacetype_script();
79 ED_spacetype_sequencer();
82 /* register operator types for screen and all spaces */
83 ED_operatortypes_screen();
84 ui_view2d_operatortypes();
85 ED_operatortypes_anim();
87 spacetypes = BKE_spacetypes_list();
88 for(type=spacetypes->first; type; type=type->next)
89 type->operatortypes();
93 /* keymap definitions are registered only once per WM initialize, usually on file read,
94 using the keymap the actual areas/regions add the handlers */
95 void ED_spacetypes_keymap(wmWindowManager *wm)
97 const ListBase *spacetypes;
101 ED_keymap_screen(wm);
102 UI_view2d_keymap(wm);
105 spacetypes = BKE_spacetypes_list();
106 for(stype=spacetypes->first; stype; stype=stype->next) {
109 for(atype=stype->regiontypes.first; atype; atype=atype->next) {
116 /* ****************************** space template *********************** */
118 /* allocate and init some vars */
119 static SpaceLink *xxx_new(void)
124 /* not spacelink itself */
125 static void xxx_free(SpaceLink *sl)
130 /* spacetype; init callback for usage, should be redoable */
131 static void xxx_init(wmWindowManager *wm, ScrArea *sa)
134 /* link area to SpaceXXX struct */
136 /* define how many regions, the order and types */
138 /* add types to regions */
141 static SpaceLink *xxx_duplicate(SpaceLink *sl)
147 static void xxx_operatortypes(void)
149 /* register operator types for this space */
152 static void xxx_keymap(wmWindowManager *wm)
154 /* add default items to keymap */
157 /* only called once, from screen/spacetypes.c */
158 void ED_spacetype_xxx(void)
162 st.spaceid= SPACE_VIEW3D;
167 st.duplicate= xxx_duplicate;
168 st.operatortypes= xxx_operatortypes;
169 st.keymap= xxx_keymap;
171 BKE_spacetype_register(&st);
174 /* ****************************** end template *********************** */