[Bf-blender-cvs] [70c3fd6] temp_widgets_c++_experiment: P

Julian Eisel noreply at git.blender.org
Sat Dec 19 16:14:52 CET 2015


Commit: 70c3fd613bcf614222b8e5e1a76b32be59557035
Author: Julian Eisel
Date:   Sat Dec 19 16:12:20 2015 +0100
Branches: temp_widgets_c++_experiment
https://developer.blender.org/rB70c3fd613bcf614222b8e5e1a76b32be59557035

P

===================================================================

M	source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
M	source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
M	source/blender/windowmanager/intern/widgets/wm_widgetmaptype.cc
M	source/blender/windowmanager/intern/widgets/wm_widgetmaptype.h
M	source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc
M	source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h
M	source/blender/windowmanager/intern/wm_widgets.c
M	source/blender/windowmanager/wm.h
M	source/blender/windowmanager/wm_event_system.h

===================================================================

diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
index d8f070c..6f96594 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
@@ -79,7 +79,7 @@ void wmWidgetGroupType::init(
 
 
 	/* init keymap - on startup there's an extra call to init keymaps for 'permanent' widget-groups */
-//	wm_widgetgrouptype_keymap_init(wgrouptype, ((wmWindowManager *)bmain->wm.first)->defaultconf);
+	keymap_init_do(((wmWindowManager *)bmain->wm.first)->defaultconf);
 
 	/* now create a widget for all existing areas */
 	for (bScreen *sc = (bScreen *)bmain->screen.first; sc; sc = (bScreen *)sc->id.next) {
@@ -138,6 +138,11 @@ void wmWidgetGroupType::unregister(bContext *C, Main *bmain)
 	delete this;
 }
 
+void wmWidgetGroupType::keymap_init_do(wmKeyConfig *keyconf)
+{
+	keymap = keymap_init(keyconf, name);
+}
+
 void wmWidgetGroupType::attach_to_handler(bContext *C, wmEventHandler *handler, wmOperator *op)
 {
 	/* now instantiate the widgetmap */
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
index 18287cd..ea0d9c3 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
@@ -55,6 +55,7 @@ public:
 	        const short spaceid, const short regionid, const bool is_3d);
 	void unregister(bContext *C, Main *bmain);
 
+	void keymap_init_do(wmKeyConfig *keyconf);
 	void attach_to_handler(bContext *C, struct wmEventHandler *handler, struct wmOperator *op);
 	size_t get_idname(char *r_idname);
 
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.cc b/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.cc
index 637565d..210db03 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.cc
@@ -33,7 +33,8 @@
 
 #include "DNA_defs.h"
 
-#include "wm_widgets_c_api.h"
+#include "wm_widgets_c_api.h" // tmp
+#include "wm_widgetgrouptype.h"
 #include "wm_widgetmaptype.h" // own include
 
 
@@ -70,3 +71,18 @@ wmWidgetMapType *WM_widgetmaptype_find(
 	return wmaptype;
 }
 
+void widgets_keymap(wmKeyConfig *keyconf)
+{
+	for (wmWidgetMapType *wmaptype = (wmWidgetMapType *)widgetmaptypes.first;
+	     wmaptype;
+	     wmaptype = wmaptype->next)
+	{
+		for (wmWidgetGroupType *wgrouptype = (wmWidgetGroupType *)wmaptype->widgetgrouptypes.first;
+		     wgrouptype;
+		     wgrouptype = wgrouptype->next)
+		{
+			wgrouptype->keymap_init_do(keyconf);
+		}
+	}
+}
+
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.h b/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.h
index 6f5f19b..c99977d 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetmaptype.h
@@ -55,4 +55,7 @@ typedef struct wmWidgetMapType {
 	ListBase widgetgrouptypes;
 } wmWidgetMapType;
 
+
+void widgets_keymap(struct wmKeyConfig *keyconf);
+
 #endif // __WM_WIDGETMAPTYPE_H__
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc b/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc
index 22e72fe..6fa7a63 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc
@@ -35,6 +35,14 @@
 #include "wm_widgets_c_api.h" // own include
 
 
+/**
+ * Initialize keymaps for all existing widget-groups
+ */
+void wm_widgets_keymap(wmKeyConfig *keyconfig)
+{
+	widgets_keymap(keyconfig);
+}
+
 wmWidgetMap *WM_widgetmap_from_type(
         const char *idname, const int spaceid, const int regionid,
         const bool is_3d)
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h b/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h
index f148a85..67925187 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h
@@ -43,6 +43,8 @@ struct wmWidgetGroup;
 struct wmWidgetGroupType;
 
 
+void wm_widgets_keymap(struct wmKeyConfig *keyconfig);
+
 struct wmWidgetMapType *WM_widgetmaptype_find(
         const char *idname, const int spaceid, const int regionid,
         const bool is_3d, const bool create);
diff --git a/source/blender/windowmanager/intern/wm_widgets.c b/source/blender/windowmanager/intern/wm_widgets.c
index 778888f..5079126 100644
--- a/source/blender/windowmanager/intern/wm_widgets.c
+++ b/source/blender/windowmanager/intern/wm_widgets.c
@@ -195,21 +195,6 @@ static void widget_calculate_scale(wmWidget *widget, const bContext *C)
 	widget->scale = scale * widget->user_scale;
 }
 
-/**
- * Initialize keymaps for all existing widget-groups
- */
-void wm_widgets_keymap(wmKeyConfig *keyconf)
-{
-	wmWidgetMapType *wmaptype;
-	wmWidgetGroupTypeC *wgrouptype;
-
-	for (wmaptype = widgetmaptypes.first; wmaptype; wmaptype = wmaptype->next) {
-		for (wgrouptype = wmaptype->widgetgrouptypes.first; wgrouptype; wgrouptype = wgrouptype->next) {
-			wm_widgetgrouptype_keymap_init(wgrouptype, keyconf);
-		}
-	}
-}
-
 BLI_INLINE bool widget_compare(const wmWidget *a, const wmWidget *b)
 {
 	return STREQ(a->idname, b->idname);
@@ -1419,8 +1404,3 @@ wmKeyMap *WM_widgetgroup_keymap_common(wmKeyConfig *config, const char *wgroupna
 	return km;
 }
 
-void wm_widgetgrouptype_keymap_init(wmWidgetGroupTypeC *wgrouptype, wmKeyConfig *keyconf)
-{
-	wgrouptype->keymap = wgrouptype->keymap_init(keyconf, wgrouptype->name);
-}
-
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index 5d26afb..56c013c 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -174,7 +174,6 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs);
 /* wm_widgets.c */
 bool wm_widgetmap_is_3d(const wmWidgetMap *wmap);
 bool wm_widget_register(wmWidgetGroup *wgroup, wmWidget *widget, const char *name);
-void wm_widgets_keymap(wmKeyConfig *keyconf);
 
 void WIDGETGROUP_OT_widget_select(wmOperatorType *ot);
 void WIDGETGROUP_OT_widget_tweak(wmOperatorType *ot);
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index f5d05ef..c8feb16 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -104,8 +104,6 @@ void        wm_drags_draw(bContext *C, wmWindow *win, rcti *rect);
 void wm_widget_handler_modal_update(bContext *C, wmEvent *event, wmEventHandler *handler);
 void wm_widgetmap_handler_context(bContext *C, wmEventHandler *handler);
 
-void wm_widgetgrouptype_keymap_init(wmWidgetGroupTypeC *wgrouptype, wmKeyConfig *keyconf);
-
 wmWidget *wm_widget_find_highlighted_3D(wmWidgetMap *wmap, bContext *C, const wmEvent *event, unsigned char *part);
 wmWidget *wm_widget_find_highlighted(wmWidgetMap *wmap, bContext *C, const wmEvent *event, unsigned char *part);
 void      wm_widgetmap_set_highlighted_widget(wmWidgetMap *wmap, bContext *C, wmWidget *widget, unsigned char part);




More information about the Bf-blender-cvs mailing list