moving dir strings into global namespace for doc access (coming up)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 15 Feb 2011 14:38:43 +0000 (14:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 15 Feb 2011 14:38:43 +0000 (14:38 +0000)
12 files changed:
source/blender/editors/screen/screen_context.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_intern.h
source/blender/editors/space_image/image_intern.h
source/blender/editors/space_image/space_image.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/space_node.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_intern.h
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_intern.h

index 7d526d217b93da84d2a8c276ee4e68bce262cafa..931cc06d6cd0817b17e2c7d7d6ddc682a33b5143 100644 (file)
 
 #include "screen_intern.h"
 
+const char *screen_context_dir[] = {
+       "scene", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
+       "selected_objects", "selected_bases",
+       "selected_editable_objects", "selected_editable_bases",
+       "visible_bones", "editable_bones", "selected_bones", "selected_editable_bones",
+       "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
+       "active_base", "active_object", "object", "edit_object",
+       "sculpt_object", "vertex_paint_object", "weight_paint_object",
+       "texture_paint_object", "particle_edit_object",
+       "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
+       NULL};
+
 int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        bScreen *sc= CTX_wm_screen(C);
@@ -67,19 +79,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 #endif
 
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {
-                       "scene", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
-                       "selected_objects", "selected_bases",
-                       "selected_editable_objects", "selected_editable_bases",
-                       "visible_bones", "editable_bones", "selected_bones", "selected_editable_bones",
-                       "visible_pose_bones", "selected_pose_bones", "active_bone", "active_pose_bone",
-                       "active_base", "active_object", "object", "edit_object",
-                       "sculpt_object", "vertex_paint_object", "weight_paint_object",
-                       "texture_paint_object", "particle_edit_object",
-                       "sequences", "selected_sequences", "selected_editable_sequences", /* sequencer */
-                       NULL};
-
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, screen_context_dir);
                return 1;
        }
        else if(CTX_data_equals(member, "scene")) {
index 2c2ba4f148e03ff762f1c572b7c6e485012deeaf..5f0d264ea4b9eb055434a1c367fdd3801cd76f31 100644 (file)
@@ -56,6 +56,8 @@ struct AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
 /* screen_context.c */
 int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result);
 
+extern const char *screen_context_dir[]; /* doc access */
+
 /* screendump.c */
 void SCREEN_OT_screenshot(struct wmOperatorType *ot);
 void SCREEN_OT_screencast(struct wmOperatorType *ot);
index ee8b67a146ac9d293e34b1681feeebeb25c103f6..fe49c20c040164292b8cea1b828dc8eaeffa87fa 100644 (file)
@@ -617,6 +617,12 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
 
 /************************* Context Callback ************************/
 
+const char *buttons_context_dir[] = {
+       "world", "object", "mesh", "armature", "lattice", "curve",
+       "meta_ball", "lamp", "camera", "material", "material_slot",
+       "texture", "texture_slot", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable",
+       "cloth", "soft_body", "fluid", "smoke", "collision", "brush", NULL};
+
 int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        SpaceButs *sbuts= CTX_wm_space_buts(C);
@@ -627,13 +633,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 
        /* here we handle context, getting data from precomputed path */
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {
-                       "world", "object", "mesh", "armature", "lattice", "curve",
-                       "meta_ball", "lamp", "camera", "material", "material_slot",
-                       "texture", "texture_slot", "bone", "edit_bone", "pose_bone", "particle_system", "particle_system_editable",
-                       "cloth", "soft_body", "fluid", "smoke", "collision", "brush", NULL};
-
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, buttons_context_dir);
                return 1;
        }
        else if(CTX_data_equals(member, "world")) {
index 9478168f35aeeffb98c018e52e86ea782eccd534..407454d43474e67aed897d1143fb8a485d142aba 100644 (file)
@@ -65,6 +65,8 @@ void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
 void buttons_context_register(struct ARegionType *art);
 struct ID *buttons_context_id_path(const struct bContext *C);
 
+extern const char *buttons_context_dir[]; /* doc access */
+
 /* buttons_ops.c */
 void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
 void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
index 1b3bd59f6481930d2922c2e25efcca2f7a1bd64d..327749125a549a4a371f0c5a27eb5537cd091700 100644 (file)
@@ -46,6 +46,8 @@ struct bNodeTree;
 struct ARegion *image_has_buttons_region(struct ScrArea *sa);
 struct ARegion *image_has_scope_region(struct ScrArea *sa);
 
+extern const char *image_context_dir[]; /* doc access */
+
 /* image_header.c */
 void image_header_buttons(const struct bContext *C, struct ARegion *ar);
 
index 6606ca4cc4e4fdb98c93cfe0cf232695ad0cc52d..1d7cb357e5fe66924697e9f08dfe683876f72708 100644 (file)
@@ -665,13 +665,14 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
        }
 }
 
+const char *image_context_dir[] = {"edit_image", NULL};
+
 static int image_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        SpaceImage *sima= CTX_wm_space_image(C);
 
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {"edit_image", NULL};
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, image_context_dir);
        }
        else if(CTX_data_equals(member, "edit_image")) {
                CTX_data_id_pointer_set(result, (ID*)ED_space_image(sima));
index 831e157deef53397b5da95156751b3bf6c32d5ac..eb7e120980189f13d5ca75ebe5a2a805392e551a 100644 (file)
@@ -121,6 +121,8 @@ void NODE_OT_backimage_sample(wmOperatorType *ot);
 
 void NODE_OT_add_file(struct wmOperatorType *ot);
 
+extern const char *node_context_dir[];
+
 // XXXXXX
 
 // XXX from BSE_node.h
index 90bf8ebb39f3e0ac9402e354e39f0298dd7ecd98..db4d02a776c485e018162bc46c859ca60deaaa6a 100644 (file)
@@ -411,13 +411,14 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
        }
 }
 
+const char *node_context_dir[] = {"selected_nodes", NULL};
+
 static int node_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        SpaceNode *snode= CTX_wm_space_node(C);
        
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {"selected_nodes", NULL};
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, node_context_dir);
                return 1;
        }
        else if(CTX_data_equals(member, "selected_nodes")) {
index e9e98a9f7bff6eecc7b81f156fc2e7a5cc4064d7..506976e1ebccdf3a17e97a7aa98c1c330f333991 100644 (file)
@@ -351,13 +351,14 @@ static void text_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "TEXT_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last!
 }
 
+const char *text_context_dir[] = {"edit_text", NULL};
+
 static int text_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        SpaceText *st= CTX_wm_space_text(C);
 
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {"edit_text", NULL};
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, text_context_dir);
                return 1;
        }
        else if(CTX_data_equals(member, "edit_text")) {
index 5f6b2e05ba745a82a68f6ae6973a13fa727d5b7d..6b0ab523075ba7365e8b8ae80b930bd616502988 100644 (file)
@@ -157,5 +157,8 @@ void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
 
 void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
 
+/* space_text.c */
+extern const char *text_context_dir[]; /* doc access */
+
 #endif /* ED_TEXT_INTERN_H */
 
index f7ccebda6aeaf28316f6dabe0528b2b0cefb9331..ef2fa693cb1d6e5af8b35c5834235298b3347e7f 100644 (file)
@@ -951,6 +951,11 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
 #endif
 }
 
+const char *view3d_context_dir[] = {
+       "selected_objects", "selected_bases", "selected_editable_objects",
+       "selected_editable_bases", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
+       "active_base", "active_object", NULL};
+
 static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
 {
        View3D *v3d= CTX_wm_view3d(C);
@@ -959,12 +964,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
        unsigned int lay = v3d ? v3d->lay:scene->lay; /* fallback to the scene layer, allows duplicate and other oject operators to run outside the 3d view */
 
        if(CTX_data_dir(member)) {
-               static const char *dir[] = {
-                       "selected_objects", "selected_bases", "selected_editable_objects",
-                       "selected_editable_bases", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
-                       "active_base", "active_object", NULL};
-
-               CTX_data_dir_set(result, dir);
+               CTX_data_dir_set(result, view3d_context_dir);
        }
        else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
                int selected_objects= CTX_data_equals(member, "selected_objects");
index 0f1fe2fba07f83acd558cd56648dc0d068eacdd7..b7efa7fced7b163299511f942c84bcff6315bc06 100644 (file)
@@ -187,6 +187,8 @@ void VIEW3D_OT_snap_cursor_to_active(struct wmOperatorType *ot);
 ARegion *view3d_has_buttons_region(ScrArea *sa);
 ARegion *view3d_has_tools_region(ScrArea *sa);
 
+extern const char *view3d_context_dir[]; /* doc access */
+
 /* draw_volume.c */
 void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);