Cleanup: move select all/none/invert into template
authorCampbell Barton <ideasman42@gmail.com>
Sun, 2 Sep 2018 11:21:15 +0000 (21:21 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 2 Sep 2018 11:25:14 +0000 (21:25 +1000)
24 files changed:
build_files/cmake/macros.cmake
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/armature/armature_ops.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/gpencil/gpencil_ops.c
source/blender/editors/include/ED_keymap_templates.h [new file with mode: 0644]
source/blender/editors/lattice/lattice_ops.c
source/blender/editors/mask/mask_edit.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/metaball/mball_ops.c
source/blender/editors/object/object_ops.c
source/blender/editors/physics/physics_ops.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/space_action/action_ops.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_graph/graph_ops.c
source/blender/editors/space_nla/nla_ops.c
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/util/CMakeLists.txt
source/blender/editors/util/keymap_templates.c [new file with mode: 0644]
source/blender/editors/uvedit/uvedit_ops.c

index a4f8d9397aa24e24181301d0f55aab3f3ef166e8..ddea41675c251e354a57d92820ca14dc36fd05c3 100644 (file)
@@ -595,7 +595,6 @@ function(SETUP_BLENDER_SORTED_LIBS)
                bf_editor_space_clip
 
                bf_editor_transform
-               bf_editor_util
                bf_editor_uvedit
                bf_editor_curve
                bf_editor_interface
@@ -616,6 +615,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
                bf_editor_datafiles
                bf_editor_mask
                bf_editor_io
+               bf_editor_util
 
                bf_render
                bf_python
index 6032b21ab88d84baeeab9e8c641253f615a17c62..389a8d0fd03692438b63796184953b0b48b21952 100644 (file)
@@ -65,6 +65,7 @@
 #include "ED_anim_api.h"
 #include "ED_armature.h"
 #include "ED_keyframes_edit.h" // XXX move the select modes out of there!
+#include "ED_keymap_templates.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
@@ -3213,12 +3214,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "ANIM_OT_channels_find", FKEY, KM_PRESS, KM_CTRL, 0);
 
        /* deselect all */
-       kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "ANIM_OT_channels_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "ANIM_OT_channels_select_all");
 
        /* borderselect */
        WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", BKEY, KM_PRESS, 0, 0);
index 2085ad869be6a44e81c71bf012abd4a5d5ed2d16..e0f9a546dfc118612107994040b7e12709cb33c8 100644 (file)
@@ -72,6 +72,7 @@
 #include "ED_markers.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_util.h"
 #include "ED_numinput.h"
 #include "ED_object.h"
@@ -1672,10 +1673,7 @@ void ED_keymap_marker(wmKeyConfig *keyconf)
 
        WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0);
 
-       kmi = WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
+       ED_keymap_template_select_all(keymap, "MARKER_OT_select_all");
 
        WM_keymap_add_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);
index 323fa36832b0448cd54334f1e2a0d7244d12df1b..f61018f52781c87a9996cb449c7807aa192723c5 100644 (file)
@@ -36,6 +36,7 @@
 #include "ED_armature.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 
 #include "armature_intern.h"
@@ -218,12 +219,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "ARMATURE_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
 
-       kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "ARMATURE_OT_select_all");
 
        kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "extend", false);
@@ -334,12 +330,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
        RNA_boolean_set(kmi->ptr, "flipped", true);
 #endif
 
-       kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "POSE_OT_select_all");
 
        WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
 
index ae07196860b27a81f3cd3d6866f4b72309b66cb7..1d84a1fe5e7f916cfef91d755404d4ce383ca9f6 100644 (file)
@@ -45,6 +45,7 @@
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 
 #include "curve_intern.h"
@@ -245,12 +246,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CURVE_OT_draw", TABLET_STYLUS, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "wait_for_input", false);
 
-       kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "CURVE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "CURVE_OT_select_all");
 
        WM_keymap_add_item(keymap, "CURVE_OT_select_row", RKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "CURVE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
index fd6cf1f9681eec474be24eafca86d70a63be47dc..db51fead5319a23ea98fb7cc7caf7ae63921cd52 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "ED_gpencil.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_object.h"
 #include "ED_transform.h"
 
@@ -197,13 +198,7 @@ static void ed_keymap_gpencil_selection(wmKeyMap *keymap)
        wmKeyMapItem *kmi;
 
        /* select all */
-       kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-
-       kmi = WM_keymap_add_item(keymap, "GPENCIL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "GPENCIL_OT_select_all");
 
        /* circle select */
        WM_keymap_add_item(keymap, "GPENCIL_OT_select_circle", CKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/include/ED_keymap_templates.h b/source/blender/editors/include/ED_keymap_templates.h
new file mode 100644 (file)
index 0000000..0a1882d
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ED_keymap_templates.h
+ *  \ingroup editors
+ */
+
+#ifndef __ED_KEYMAP_TEMPLATES_H__
+#define __ED_KEYMAP_TEMPLATES_H__
+
+struct wmKeyMap;
+
+void ED_keymap_template_select_all(struct wmKeyMap *keymap, const char *idname);
+
+#endif /*  __ED_KEYMAP_TEMPLATES_H__ */
index 2e6eafb08869a296cb9ac06b546e6315deb788ef..d0c9a385cf2d33c2f3f1aaebdd033c1cf04486e8 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_object.h"
 #include "ED_lattice.h"
 
@@ -62,12 +63,8 @@ void ED_keymap_lattice(wmKeyConfig *keyconf)
        keymap = WM_keymap_ensure(keyconf, "Lattice", 0, 0);
        keymap->poll = ED_operator_editlattice;
 
-       kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "LATTICE_OT_select_all");
+
        WM_keymap_add_item(keymap, "LATTICE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "LATTICE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
 
index d734f4fbb9388992e0b1fa129a36108a2c563805..1d815277ed41415ddb7d369fdfc6410082b03015 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_mask.h"  /* own include */
 #include "ED_image.h"
 #include "ED_object.h" /* ED_keymap_proportional_maskmode only */
@@ -555,12 +556,7 @@ void ED_keymap_mask(wmKeyConfig *keyconf)
        RNA_boolean_set(kmi->ptr, "deselect", false);
        RNA_boolean_set(kmi->ptr, "toggle", true);
 
-       kmi = WM_keymap_add_item(keymap, "MASK_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "MASK_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "MASK_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "MASK_OT_select_all");
 
        WM_keymap_add_item(keymap, "MASK_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
        kmi = WM_keymap_add_item(keymap, "MASK_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
index a318b3b78e53a664c5a4ace63bceb890810a92e9..acd8079e75a92764f75cf276466672d4f8552154 100644 (file)
@@ -41,6 +41,7 @@
 #include "ED_mesh.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 
 #include "mesh_intern.h"  /* own include */
 
@@ -379,12 +380,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "MESH_OT_shortest_path_pick", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "use_fill", true);
 
-       kmi = WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "MESH_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "MESH_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "MESH_OT_select_all");
 
        WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
index 97636b5914312c59590572e3a89ea6e2e1620ac8..c3c404f37ac19bdde7030138c00a1ad574d35bbe 100644 (file)
@@ -38,6 +38,7 @@
 #include "ED_mball.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_object.h"
 
 #include "mball_intern.h"
@@ -89,12 +90,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
 
        WM_keymap_add_item(keymap, "MBALL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
 
-       kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "MBALL_OT_select_all");
 
        WM_keymap_add_item(keymap, "MBALL_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
 
index ca13f32ec524e13d61018e0dc81f86bf75d7dc33..d504a0e21f857a39d12de759690b86cc8fff97fa 100644 (file)
@@ -47,6 +47,7 @@
 
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_object.h"
 
 #include "DEG_depsgraph.h"
@@ -334,12 +335,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
        ED_keymap_proportional_cycle(keyconf, keymap);
        ED_keymap_proportional_obmode(keyconf, keymap);
 
-       kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "OBJECT_OT_select_all");
 
        WM_keymap_add_item(keymap, "OBJECT_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "OBJECT_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
index c95e7bb3e15f93f851d3e68a1a69ba4003a57896..fc2a6bad561cdf38c3d1818a725fae2a51fecb28 100644 (file)
@@ -35,6 +35,7 @@
 #include "WM_types.h"
 
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_physics.h"
 #include "ED_object.h"
 
@@ -117,12 +118,7 @@ static void keymap_particle(wmKeyConfig *keyconf)
        keymap = WM_keymap_ensure(keyconf, "Particle", 0, 0);
        keymap->poll = PE_poll;
 
-       kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "PARTICLE_OT_select_all");
 
        WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
index 05be3db635f1995d875c40ba395bb46681e7e446..eb619e1bbb7f6c4aacc52851bf8973436663bc17 100644 (file)
@@ -49,6 +49,7 @@
 #include "ED_paint.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_image.h"
 #include "ED_gpencil.h"
 #include "UI_resources.h"
@@ -1437,12 +1438,9 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        /*Weight paint's Vertex Selection Mode */
        keymap = WM_keymap_ensure(keyconf, "Weight Paint Vertex Selection", 0, 0);
        keymap->poll = vert_paint_poll;
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+
+       ED_keymap_template_select_all(keymap, "PAINT_OT_vert_select_all");
+
        WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
        kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
        RNA_enum_set(kmi->ptr, "mode", SEL_OP_ADD);
@@ -1482,12 +1480,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
        keymap = WM_keymap_ensure(keyconf, "Face Mask", 0, 0);
        keymap->poll = facemask_paint_poll;
 
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "PAINT_OT_face_select_all");
+
        kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, 0, 0);
        RNA_boolean_set(kmi->ptr, "unselected", false);
        kmi = WM_keymap_add_item(keymap, "PAINT_OT_face_select_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
index 4976ffa3fc3289885d2aa45b42cf2234b2f9019e..290020c7840089cc63dcd6b5397beb89897d8070 100644 (file)
@@ -41,6 +41,7 @@
 #include "ED_transform.h"
 #include "ED_object.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 
 #include "action_intern.h"
 
@@ -171,12 +172,7 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
        RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT);
 
        /* deselect all */
-       kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "ACTION_OT_select_all");
 
        /* borderselect */
        kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_border", BKEY, KM_PRESS, 0, 0);
index bee266285d35dc3f2f86f0b3ad2a4714e2434ca4..a6fc6da9a556b4cdbfe7a4c521b69c287728e0ee 100644 (file)
@@ -56,6 +56,7 @@
 #include "ED_space_api.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_clip.h"
 #include "ED_transform.h"
 #include "ED_uvedit.h"  /* just for ED_image_draw_cursor */
@@ -646,12 +647,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CLIP_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "extend", true);
 
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "CLIP_OT_select_all");
+
        WM_keymap_add_item(keymap, "CLIP_OT_select_border", BKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "CLIP_OT_select_circle", CKEY, KM_PRESS, 0, 0);
        WM_keymap_add_menu(keymap, "CLIP_MT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
@@ -765,12 +762,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
        RNA_boolean_set(kmi->ptr, "extend", true);
 
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select_all_markers", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select_all_markers", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select_all_markers", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "CLIP_OT_graph_select_all_markers");
 
        WM_keymap_add_item(keymap, "CLIP_OT_graph_select_border", BKEY, KM_PRESS, 0, 0);
 
index 8699bb595fa36843f55dcd2e68d8a12689ef6394..c212ad8f01017947ba522087e55b3336152056e7 100644 (file)
@@ -49,6 +49,7 @@
 #include "ED_markers.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 #include "ED_object.h"
 
@@ -552,12 +553,7 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap)
        RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
 
        /* deselect all */
-       kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "GRAPH_OT_select_all");
 
        /* borderselect */
        kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_border", BKEY, KM_PRESS, 0, 0);
index 53e9321b2e87524a6c00f7d4eba9ac2260e2c28a..99cdf27326c749fd9bc93c8bcd40ac654879d5e8 100644 (file)
@@ -40,6 +40,7 @@
 #include "ED_markers.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 
 #include "WM_api.h"
@@ -225,12 +226,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap)
        RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
 
        /* deselect all */
-       kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "NLA_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "NLA_OT_select_all");
 
        /* borderselect */
        kmi = WM_keymap_add_item(keymap, "NLA_OT_select_border", BKEY, KM_PRESS, 0, 0);
index 759b157b3f8d6531301689f0ceffed306a11da60..9e66d1424dba13f7f3c582fd9b0b18ca8e1a441b 100644 (file)
@@ -38,6 +38,7 @@
 #include "ED_node.h"  /* own include */
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 
 #include "RNA_access.h"
@@ -314,12 +315,7 @@ void node_keymap(struct wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", DELKEY, KM_PRESS, KM_CTRL, 0);
 
-       kmi = WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "NODE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "NODE_OT_select_all");
 
        WM_keymap_add_item(keymap, "NODE_OT_select_linked_to", LKEY, KM_PRESS, KM_SHIFT, 0);
        WM_keymap_add_item(keymap, "NODE_OT_select_linked_from", LKEY, KM_PRESS, 0, 0);
index 66fd680a1e0531263dbb70c43d89a6e42247ebf6..7e8954ad0d19bcfeda7a6e29b7d4ea622006f983 100644 (file)
@@ -53,6 +53,7 @@
 
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 
 #include "outliner_intern.h"
 
@@ -170,12 +171,7 @@ void outliner_keymap(wmKeyConfig *keyconf)
        kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_show_one_level", PADMINUS, KM_PRESS, 0, 0);
        RNA_boolean_set(kmi->ptr, "open", false); /* close */
 
-       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "OUTLINER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "OUTLINER_OT_select_all");
 
        WM_keymap_add_item(keymap, "OUTLINER_OT_expanded_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
 
index bf1804955d7c966678ff96e7c994729be2ade850..61b6a6dc515bb70656f54acd02c326703228a0bb 100644 (file)
@@ -40,6 +40,7 @@
 #include "ED_markers.h"
 #include "ED_transform.h" /* transform keymap */
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 
 #include "BKE_sequencer.h"
 
@@ -151,12 +152,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
        /* Strips Region --------------------------------------------------------------- */
        keymap = WM_keymap_ensure(keyconf, "Sequencer", SPACE_SEQ, 0);
 
-       kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "SEQUENCER_OT_select_all");
 
        kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0);
        RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT);
index 3fd8656ad2c947245393a2e5800aec16762798fe..4321365fb4fbff712acdebe53d4dcf39bf0f54c1 100644 (file)
@@ -40,6 +40,7 @@ set(INC_SYS
 )
 
 set(SRC
+       keymap_templates.c
        ed_transverts.c
        ed_util.c
        numinput.c
@@ -62,6 +63,7 @@ set(SRC
        ../include/ED_keyframes_draw.h
        ../include/ED_keyframes_edit.h
        ../include/ED_keyframing.h
+       ../include/ED_keymap_templates.h
        ../include/ED_lattice.h
        ../include/ED_logic.h
        ../include/ED_markers.h
diff --git a/source/blender/editors/util/keymap_templates.c b/source/blender/editors/util/keymap_templates.c
new file mode 100644 (file)
index 0000000..aac7b3e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/util/keymap_templates.c
+ *  \ingroup edutil
+ */
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+
+#include "ED_select_utils.h"
+#include "ED_keymap_templates.h"  /* own include */
+
+void ED_keymap_template_select_all(wmKeyMap *keymap, const char *idname)
+{
+       wmKeyMapItem *kmi;
+
+       kmi = WM_keymap_add_item(keymap, idname, AKEY, KM_PRESS, 0, 0);
+       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
+       kmi = WM_keymap_add_item(keymap, idname, AKEY, KM_PRESS, KM_ALT, 0);
+       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
+       kmi = WM_keymap_add_item(keymap, idname, IKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+}
index 80c443ab1ebc98561a77b53d40a859f8c01feb3e..09afe1973d536732ee2119299e492238032ec80d 100644 (file)
@@ -77,6 +77,7 @@
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_select_utils.h"
+#include "ED_keymap_templates.h"
 #include "ED_transform.h"
 
 #include "RNA_access.h"
@@ -4456,12 +4457,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "UV_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
        WM_keymap_add_item(keymap, "UV_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
 
-       kmi = WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_SELECT);
-       kmi = WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, KM_ALT, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_DESELECT);
-       kmi = WM_keymap_add_item(keymap, "UV_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-       RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+       ED_keymap_template_select_all(keymap, "UV_OT_select_all");
 
        WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0);