[Bf-blender-cvs] [8fc8ca7] temp_widgets_c++_experiment: Cleanup: Naming, comments, use constructors instead of init functions
Julian Eisel
noreply at git.blender.org
Sun Dec 20 20:34:57 CET 2015
Commit: 8fc8ca7f7bce3e20ff415100ca04c93606d25b95
Author: Julian Eisel
Date: Sun Dec 20 20:33:55 2015 +0100
Branches: temp_widgets_c++_experiment
https://developer.blender.org/rB8fc8ca7f7bce3e20ff415100ca04c93606d25b95
Cleanup: Naming, comments, use constructors instead of init functions
===================================================================
M source/blender/editors/space_graph/graph_edit.c
M source/blender/editors/space_graph/space_graph.c
M source/blender/editors/space_node/space_node.c
M source/blender/editors/space_sequencer/sequencer_view.c
M source/blender/editors/space_sequencer/space_sequencer.c
M source/blender/editors/space_view3d/space_view3d.c
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_widgetmap.cc
M source/blender/windowmanager/intern/widgets/wm_widgetmap.h
M source/blender/windowmanager/intern/widgets/wm_widgets_c_api.cc
M source/blender/windowmanager/intern/widgets/wm_widgets_c_api.h
===================================================================
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 56310ee..be272b2 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2661,7 +2661,7 @@ static void graph_widget_backdrop_transform_finish(bContext *C, BackDropTransfor
{
ScrArea *sa = CTX_wm_area(C);
ED_area_headerprint(sa, NULL);
- WM_widgetgrouptype_unregister(C, CTX_data_main(C), data->cagetype);
+ WM_widgetgrouptype_delete(C, CTX_data_main(C), data->cagetype);
MEM_freeN(data);
}
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index b15c1b8..257385f 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -226,7 +226,7 @@ static void graph_main_region_init(wmWindowManager *wm, ARegion *ar)
/* widgets */
if (BLI_listbase_is_empty(&ar->widgetmaps)) {
- BLI_addhead(&ar->widgetmaps, WM_widgetmap_from_type("Graph_Canvas", SPACE_IPO, RGN_TYPE_WINDOW, false));
+ BLI_addhead(&ar->widgetmaps, WM_widgetmap_new("Graph_Canvas", SPACE_IPO, RGN_TYPE_WINDOW, false));
}
}
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 7946030..1754ad6 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -649,7 +649,7 @@ static void node_main_region_init(wmWindowManager *wm, ARegion *ar)
/* widgets stay in the background for now - quick patchjob to make sure nodes themselves work */
if (BLI_listbase_is_empty(&ar->widgetmaps)) {
- BLI_addhead(&ar->widgetmaps, WM_widgetmap_from_type("Node_Canvas", SPACE_NODE, RGN_TYPE_WINDOW, false));
+ BLI_addhead(&ar->widgetmaps, WM_widgetmap_new("Node_Canvas", SPACE_NODE, RGN_TYPE_WINDOW, false));
}
WM_event_add_area_widgetmap_handlers(ar);
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 21a1d8b..fec9d09 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -320,7 +320,7 @@ static void sequencer_overdrop_finish(bContext *C, OverDropTransformData *data)
{
ScrArea *sa = CTX_wm_area(C);
ED_area_headerprint(sa, NULL);
- WM_widgetgrouptype_unregister(C, CTX_data_main(C), data->cagetype);
+ WM_widgetgrouptype_delete(C, CTX_data_main(C), data->cagetype);
MEM_freeN(data);
}
@@ -489,7 +489,7 @@ static void sequencer_image_transform_widget_finish(bContext *C, ImageTransformD
{
ScrArea *sa = CTX_wm_area(C);
ED_area_headerprint(sa, NULL);
- WM_widgetgrouptype_unregister(C, CTX_data_main(C), data->cagetype);
+ WM_widgetgrouptype_delete(C, CTX_data_main(C), data->cagetype);
MEM_freeN(data);
}
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 70adde9..dbfcd96 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -486,7 +486,7 @@ static void sequencer_main_region_init(wmWindowManager *wm, ARegion *ar)
/* no modal keymap here, only operators use this currently */
if (BLI_listbase_is_empty(&ar->widgetmaps)) {
- BLI_addhead(&ar->widgetmaps, WM_widgetmap_from_type("Seq_Canvas", SPACE_SEQ, RGN_TYPE_WINDOW, false));
+ BLI_addhead(&ar->widgetmaps, WM_widgetmap_new("Seq_Canvas", SPACE_SEQ, RGN_TYPE_WINDOW, false));
}
}
@@ -566,7 +566,7 @@ static void sequencer_preview_region_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
if (BLI_listbase_is_empty(&ar->widgetmaps)) {
- BLI_addhead(&ar->widgetmaps, WM_widgetmap_from_type("Seq_Canvas", SPACE_SEQ, RGN_TYPE_PREVIEW, false));
+ BLI_addhead(&ar->widgetmaps, WM_widgetmap_new("Seq_Canvas", SPACE_SEQ, RGN_TYPE_PREVIEW, false));
}
}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 2808b3d..5c4e206 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -501,7 +501,7 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
if (BLI_listbase_is_empty(&ar->widgetmaps)) {
- BLI_addhead(&ar->widgetmaps, WM_widgetmap_from_type("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW, true));
+ BLI_addhead(&ar->widgetmaps, WM_widgetmap_new("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW, true));
}
WM_event_add_area_widgetmap_handlers(ar);
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
index 5aa3549..0b50da2 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.cc
@@ -50,27 +50,29 @@
#include "wm_widgetgrouptype.h" // own include
-wmWidgetGroupType::wmWidgetGroupType()
-{
-
-}
-
-void wmWidgetGroupType::init(
- wmWidgetMapType *wmaptype, wmWidgetGroupType *wgrouptype,
+wmWidgetGroupType::wmWidgetGroupType(
+ wmWidgetMapType *wmaptype,
int (*poll)(const bContext *, wmWidgetGroupType *),
void (*create)(const bContext *, wmWidgetGroup *),
wmKeyMap *(*keymap_init)(wmKeyConfig *, const char *),
- const Main *bmain, const char *mapidname, const char *name,
- const short spaceid, const short regionid, const bool is_3d)
+ const Main *bmain,
+ const char *mapidname_,
+ const char *name_,
+ const short spaceid,
+ const short regionid,
+ const bool is_3d)
+ : poll(poll),
+ create(create),
+ keymap_init(keymap_init),
+ spaceid(spaceid),
+ regionid(regionid),
+ is_3d(is_3d)
{
- wgrouptype->poll = poll;
- wgrouptype->create = create;
- wgrouptype->keymap_init = keymap_init;
- wgrouptype->spaceid = spaceid;
- wgrouptype->regionid = regionid;
- wgrouptype->is_3d = is_3d;
- BLI_strncpy(wgrouptype->name, name, MAX_NAME);
- BLI_strncpy(wgrouptype->mapidname, mapidname, MAX_NAME);
+ BLI_strncpy(name, name_, MAX_NAME);
+ BLI_strncpy(mapidname, mapidname_, MAX_NAME);
+
+ /* add the type for future created areas of the same type */
+ BLI_addtail(&wmaptype->widgetgrouptypes, this);
/* Main is missing on startup when we create new areas.
* So this is only called for widgets initialized on runtime */
@@ -91,7 +93,7 @@ void wmWidgetGroupType::init(
if (wmap->type == wmaptype) {
wmWidgetGroup *wgroup = new wmWidgetGroup;
- wgroup->type_cxx = wgrouptype;
+ wgroup->type_cxx = this;
/* just add here, drawing will occur on next update */
BLI_addtail(&wmap->widgetgroups, wgroup);
@@ -105,7 +107,7 @@ void wmWidgetGroupType::init(
}
}
-void wmWidgetGroupType::unregister(bContext *C, Main *bmain)
+void wmWidgetGroupType::free(bContext *C, Main *bmain)
{
for (bScreen *sc = (bScreen *)bmain->screen.first; sc; sc = (bScreen *)sc->id.next) {
for (ScrArea *sa = (ScrArea *)sc->areabase.first; sa; sa = sa->next) {
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
index a5d07e4..b414648 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetgrouptype.h
@@ -43,17 +43,19 @@ struct wmWidgetMapType;
class wmWidgetGroupType
{
public:
- wmWidgetGroupType();
wmWidgetGroupType *next, *prev;
- void init(
- wmWidgetMapType *wmaptype, wmWidgetGroupType *wgrouptype,
+ /**
+ * \brief wmWidgetGroupType Constructor
+ */
+ wmWidgetGroupType(
+ wmWidgetMapType *wmaptype,
int (*poll)(const bContext *, wmWidgetGroupType *),
void (*create)(const bContext *, wmWidgetGroup *),
wmKeyMap *(*keymap_init)(wmKeyConfig *, const char *),
const Main *bmain, const char *mapidname, const char *name,
const short spaceid, const short regionid, const bool is_3d);
- void unregister(bContext *C, Main *bmain);
+ void free(bContext *C, Main *bmain);
void keymap_init_do(wmKeyConfig *keyconf);
void attach_to_handler(bContext *C, struct wmEventHandler *handler, struct wmOperator *op);
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc b/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
index 211a355..7eb12d5 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetmap.cc
@@ -52,11 +52,7 @@
#include "wm_widgetmap.h" // own include
-wmWidgetMap::wmWidgetMap()
-{
-}
-
-void wmWidgetMap::init(const char *idname, const int spaceid, const int regionid, const bool is_3d)
+wmWidgetMap::wmWidgetMap(const char *idname, const int spaceid, const int regionid, const bool is_3d)
{
wmWidgetMapType *wmaptype = WM_widgetmaptype_find(idname, spaceid, regionid, is_3d, true);
diff --git a/source/blender/windowmanager/intern/widgets/wm_widgetmap.h b/source/blender/windowmanager/intern/widgets/wm_widgetmap.h
index ea1132e..5e65a60 100644
--- a/source/blender/windowmanager/intern/widgets/wm_widgetmap.h
+++ b/source/blender/windowmanager/intern/widgets/wm_widgetmap.h
@@ -40,14 +40,16 @@ struct wmWidgetMapType;
class wmWidgetMap
{
public:
- wmWidgetMap();
- struct wmWidgetMap *next, *prev;
+ wmWidgetMap *next, *prev;
+
+ /**
+ * \brief wmWidgetMap Constructor
+ */
+ wmWidgetMap(const char *idname, const int spaceid, const int regionid, const bool is_3d);
wmWidgetMapType *type;
ListBase widgetgroups;
- void init(const char *idname, const int spaceid, const int regionid, const bool is_3d);
-
void set_highlighted_widget(struct bContext *C, wmWidget *widget, unsigned char part);
wmWidget *find_highlighted_widget(bContext *C, const struct wmEvent *event, unsigned char *part);
void set_active_widget(bContext *C, const wmEvent *event, wmWidget *widget);
diff --git a/source/blender/windowmanager/inter
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list