[Bf-blender-cvs] [92c89aa] temp_widgets_files_refactor: Move wmWidget structs and defines into own header files
Julian Eisel
noreply at git.blender.org
Mon Feb 8 20:03:11 CET 2016
Commit: 92c89aa8c2831bf341e9ab57329bb4f71e746c9a
Author: Julian Eisel
Date: Mon Feb 8 19:59:51 2016 +0100
Branches: temp_widgets_files_refactor
https://developer.blender.org/rB92c89aa8c2831bf341e9ab57329bb4f71e746c9a
Move wmWidget structs and defines into own header files
For external structs/defines we now have windowmanager/widgets/WM_widgets_types.h.
Also some cleanup.
===================================================================
M source/blender/editors/space_view3d/view3d_widgets.c
M source/blender/makesdna/DNA_widget_types.h
M source/blender/windowmanager/CMakeLists.txt
M source/blender/windowmanager/WM_api.h
M source/blender/windowmanager/WM_types.h
M source/blender/windowmanager/widgets/WM_widgets_api.h
A source/blender/windowmanager/widgets/WM_widgets_types.h
M source/blender/windowmanager/widgets/widget_library/plane_widget.c
M source/blender/windowmanager/widgets/wm_widget.c
M source/blender/windowmanager/widgets/wm_widgetgroup.c
M source/blender/windowmanager/widgets/wm_widgets.h
M source/blender/windowmanager/wm.h
M source/blender/windowmanager/wm_event_system.h
===================================================================
diff --git a/source/blender/editors/space_view3d/view3d_widgets.c b/source/blender/editors/space_view3d/view3d_widgets.c
index e23cea7..a0fe244 100644
--- a/source/blender/editors/space_view3d/view3d_widgets.c
+++ b/source/blender/editors/space_view3d/view3d_widgets.c
@@ -38,6 +38,7 @@
#include "DNA_object_types.h"
#include "DNA_object_force.h"
#include "DNA_lamp_types.h"
+#include "DNA_widget_types.h"
#include "ED_armature.h"
#include "ED_screen.h"
diff --git a/source/blender/makesdna/DNA_widget_types.h b/source/blender/makesdna/DNA_widget_types.h
index 5fa2cd8..72017f2 100644
--- a/source/blender/makesdna/DNA_widget_types.h
+++ b/source/blender/makesdna/DNA_widget_types.h
@@ -44,7 +44,7 @@ typedef enum WidgetType {
WT_CUSTOM = 3,
} WidgetType;
-struct wmWidgetGroup {
+typedef struct wmWidgetGroup {
struct wmWidgetGroup *next, *prev;
struct wmWidgetGroupType *type;
@@ -55,6 +55,6 @@ struct wmWidgetGroup {
int flag;
int pad;
-};
+} wmWidgetGroup;
#endif
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 7167eba..a8bfdf6 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -67,7 +67,6 @@ set(SRC
intern/wm_subwindow.c
intern/wm_window.c
intern/wm_stereo.c
- intern/wm_widgets.c
widgets/wm_widget.c
widgets/wm_widgetgroup.c
widgets/wm_widgetmap.c
@@ -94,6 +93,7 @@ set(SRC
widgets/WM_widgets_api.h
widgets/wm_widgets.h
widgets/wm_widgets_intern.h
+ widgets/WM_widgets_types.h
widgets/widget_library/widget_geometry.h
widgets/widget_library/widget_library.h
)
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index e384bae..fad8413 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -43,7 +43,7 @@
#include "WM_keymap.h"
#include "BLI_compiler_attrs.h"
-#include "widgets/WM_widgets_api.h" /* widgets API */
+#include "widgets/WM_widgets_api.h"
#ifdef __cplusplus
extern "C" {
@@ -58,11 +58,6 @@ struct wmGesture;
struct wmJob;
struct wmOperatorType;
struct wmOperator;
-struct wmWidget;
-struct wmWidgetGroup;
-struct wmWidgetMap;
-struct wmWidgetGroupType;
-struct wmWidgetMapType;
struct rcti;
struct PointerRNA;
struct PropertyRNA;
@@ -77,6 +72,8 @@ struct Main;
struct Object;
typedef struct wmJob wmJob;
+typedef struct wmWidget wmWidget;
+typedef struct wmWidgetMapType wmWidgetMapType;
/* general API */
void WM_init_state_size_set (int stax, int stay, int sizx, int sizy);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index a634b7c..c42c72c 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -121,6 +121,7 @@ struct ImBuf;
/* exported types for WM */
#include "wm_cursors.h"
#include "wm_event_types.h"
+#include "widgets/WM_widgets_types.h"
/* ************** wmOperatorType ************************ */
@@ -673,100 +674,6 @@ typedef struct wmDropBox {
} wmDropBox;
-/* WidgetGroups store and manage groups of widgets.
- * They are responsible for drawing necessary widgets and updating their state and position. */
-typedef struct wmWidget wmWidget;
-typedef struct wmWidgetGroup wmWidgetGroup;
-typedef struct wmWidgetMapType wmWidgetMapType;
-
-/* factory class for a widgetgroup type, gets called every time a new area is spawned */
-typedef struct wmWidgetGroupType {
- struct wmWidgetGroupType *next, *prev;
-
- char idname[64]; /* MAX_NAME */
- char name[64]; /* widget group name - displayed in UI (keymap editor) */
-
- /* poll if widgetmap should be active */
- int (*poll)(const struct bContext *C, struct wmWidgetGroupType *wgrouptype) ATTR_WARN_UNUSED_RESULT;
-
- /* update widgets, called right before drawing */
- void (*create)(const struct bContext *C, struct wmWidgetGroup *wgroup);
-
- /* keymap init callback for this widgetgroup */
- struct wmKeyMap *(*keymap_init)(const struct wmWidgetGroupType *wgrouptype, struct wmKeyConfig *);
-
- /* keymap created with callback from above */
- struct wmKeyMap *keymap;
-
- /* rna for properties */
- struct StructRNA *srna;
-
- /* RNA integration */
- ExtensionRNA ext;
-
- /* widgetTypeflags (copy of wmWidgetMapType.flag - used for comparisons) */
- int flag;
-
- /* if type is spawned from operator this is set here */
- void *op;
-
- /* same as widgetmaps, so registering/unregistering goes to the correct region */
- short spaceid, regionid;
- char mapidname[64];
-} wmWidgetGroupType;
-
-typedef struct wmWidgetMap {
- struct wmWidgetMap *next, *prev;
-
- wmWidgetMapType *type;
- ListBase widgetgroups;
-
- /**
- * \brief Widget map runtime context
- *
- * Contains information about this widget map. Currently
- * highlighted widget, currently selected widgets, ...
- */
- struct {
- /* we redraw the widgetmap when this changes */
- wmWidget *highlighted_widget;
- /* user has clicked this widget and it gets all input */
- wmWidget *active_widget;
- /* array for all selected widgets
- * TODO check on using BLI_array */
- wmWidget **selected_widgets;
- int tot_selected;
-
- /* set while widget is highlighted/active */
- wmWidgetGroup *activegroup;
- } wmap_context;
-} wmWidgetMap;
-
-/* wmWidget->flag */
-enum eWidgetFlag {
- /* states */
- WM_WIDGET_HIGHLIGHT = (1 << 0),
- WM_WIDGET_ACTIVE = (1 << 1),
- WM_WIDGET_SELECTED = (1 << 2),
- /* settings */
- WM_WIDGET_DRAW_HOVER = (1 << 3),
- WM_WIDGET_DRAW_ACTIVE = (1 << 4), /* draw while dragging */
- WM_WIDGET_SCALE_3D = (1 << 5),
- WM_WIDGET_SCENE_DEPTH = (1 << 6), /* widget is depth culled with scene objects*/
- WM_WIDGET_HIDDEN = (1 << 7),
- WM_WIDGET_SELECTABLE = (1 << 8),
-};
-
-/* wmWidgetType->flag */
-enum eWidgetTypeFlag {
- /**
- * Check if widgetmap does 3D drawing
- * (uses a different kind of interaction),
- * - 3d: use glSelect buffer.
- * - 2d: use simple cursor position intersection test. */
- WM_WIDGET_TYPE_3D = (1 << 0),
-};
-
/* *************** migrated stuff, clean later? ************** */
typedef struct RecentFile {
diff --git a/source/blender/windowmanager/widgets/WM_widgets_api.h b/source/blender/windowmanager/widgets/WM_widgets_api.h
index 15b98db..492f1a7 100644
--- a/source/blender/windowmanager/widgets/WM_widgets_api.h
+++ b/source/blender/windowmanager/widgets/WM_widgets_api.h
@@ -23,7 +23,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/windowmanager/widgets/wm_widgets_api.h
+/** \file blender/windowmanager/widgets/WM_widgets_api.h
* \ingroup wm
*
* \name Widget API
@@ -88,7 +88,6 @@ void WM_widgetgrouptype_init_runtime(
struct wmWidgetGroupType *wgrouptype);
void WM_widgetgrouptype_unregister(struct bContext *C, struct Main *bmain, struct wmWidgetGroupType *wgroup);
-
void WM_widgetgroup_attach_to_modal_handler(struct bContext *C, struct wmEventHandler *handler,
struct wmWidgetGroupType *wgrouptype, struct wmOperator *op);
wmKeyMap *WM_widgetgroup_keymap_common(const struct wmWidgetGroupType *wgrouptype, wmKeyConfig *config);
diff --git a/source/blender/windowmanager/widgets/WM_widgets_types.h b/source/blender/windowmanager/widgets/WM_widgets_types.h
new file mode 100644
index 0000000..ffa778e
--- /dev/null
+++ b/source/blender/windowmanager/widgets/WM_widgets_types.h
@@ -0,0 +1,137 @@
+/*
+ * ***** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/windowmanager/widgets/WM_widgets_types.h
+ * \ingroup wm
+ *
+ * \name Widget Types
+ * \brief Widget defines for external use.
+ *
+ * Only included in WM_types.h
+ */
+
+
+#ifndef __WM_WIDGETS_TYPES__
+#define __WM_WIDGETS_TYPES__
+
+#include "BLI_compiler_attrs.h"
+
+struct wmWidgetGroup;
+
+
+/* factory class for a widgetgroup type, gets called every time a new area is spawned */
+typedef struct wmWidgetGroupType {
+ struct wmWidgetGroupType *next, *prev;
+
+ char idname[64]; /* MAX_NAME */
+ char name[64]; /* widget group name - displayed in UI (keymap editor) */
+
+ /* poll if widgetmap should be active */
+ int (*poll)(const struct bContext *C, struct wmWidgetGroupType *wgrouptype) ATTR_WARN_UNUSED_RESULT;
+
+ /* update widgets, called right before drawing */
+ void (*create)(const struct bContext *C, struct wmWidgetGroup *wgroup);
+
+ /* keymap init callback for this widgetgroup */
+ struct wmKeyMap *(*keymap_init)(const struct wmWidgetGroupType *wgrouptype, struct wmKeyConfig *);
+
+ /* keymap created with callback from above */
+ struct wmKeyMap *keymap;
+
+ /* rna for properties */
+ struct StructRNA *srna;
+
+ /* RNA integration */
+ ExtensionRNA ext;
+
+ /* widgetTypeflags (copy of wmWidgetMapType.flag - used for comparisons) */
+ int flag;
+
+ /* if type is spawned from operator this is set here */
+ void *op;
+
+ /* same as widgetmaps, so registering/unregistering goes to the correct region */
+ short spaceid, regionid;
+ char mapidname[64];
+} wmWidgetGroupType;
+
+
+typedef struct wmWidgetMap {
+ struct wmWidgetMap *next, *prev;
+
+ struct wmWidgetMapType *type;
+ ListBase widgetgroups;
+
+ /**
+ * \brief Widget map runtime context
+ *
+ * Contains information about this widget map. Currently
+ * highlighted widget, currently selected widgets, ...
+ */
+ struct {
+ /* we
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list