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:
authorCampbell Barton <ideasman42@gmail.com>2009-10-08 23:06:32 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-10-08 23:06:32 +0400
commit5c867406aa66a1d89260c233a6bbc1a2a7912dbe (patch)
tree0cce14e7a49cb61b6114b69f457ca6a920db8de4 /source/blender/windowmanager/intern/wm.c
parent3ebd58673fb9a8c5ef13048b2e8e8a4cb7bb3a4e (diff)
menus are now global (like operators), so for eg, the info add menu and the 3D add menu can be shared.
Diffstat (limited to 'source/blender/windowmanager/intern/wm.c')
-rw-r--r--source/blender/windowmanager/intern/wm.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index a068f84ae29..dbb8fc400c0 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -26,6 +26,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "string.h"
+
#include "DNA_windowmanager_types.h"
#include "MEM_guardedalloc.h"
@@ -39,6 +41,7 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_screen.h"
#include "BKE_report.h"
#include "WM_api.h"
@@ -128,6 +131,49 @@ void WM_operator_stack_clear(bContext *C)
/* ****************************************** */
+static ListBase menutypes = {NULL, NULL}; /* global menutype list */
+
+MenuType *WM_menutype_find(const char *idname, int quiet)
+{
+ MenuType* mt;
+
+ if (idname[0]) {
+ for(mt=menutypes.first; mt; mt=mt->next)
+ if(strcmp(idname, mt->idname)==0)
+ return mt;
+ }
+
+ if(!quiet)
+ printf("search for unknown menutype %s\n", idname);
+
+ return NULL;
+}
+
+int WM_menutype_add(MenuType* mt)
+{
+ BLI_addtail(&menutypes, mt);
+ return 1;
+}
+
+void WM_menutype_freelink(MenuType* mt)
+{
+ BLI_freelinkN(&menutypes, mt);
+}
+
+void WM_menutype_free(void)
+{
+ MenuType* mt;
+
+ for(mt= menutypes.first; mt; mt= mt->next) {
+ if(mt->ext.free) {
+ mt->ext.free(mt->ext.data);
+ }
+ WM_menutype_freelink(mt);
+ }
+}
+
+/* ****************************************** */
+
void WM_keymap_init(bContext *C)
{
wmWindowManager *wm= CTX_wm_manager(C);