[Bf-blender-cvs] [c1a5e6b] master: Shortcut-to-string converter: add 'dbl-' in front of key when expecting a double-click.

Bastien Montagne noreply at git.blender.org
Sun Jul 12 21:56:07 CEST 2015


Commit: c1a5e6b2fd7ae48432da9645f171d8fb1731bc6d
Author: Bastien Montagne
Date:   Sun Jul 12 21:39:59 2015 +0200
Branches: master
https://developer.blender.org/rBc1a5e6b2fd7ae48432da9645f171d8fb1731bc6d

Shortcut-to-string converter: add 'dbl-' in front of key when expecting a double-click.

I think this is the only Keymap value we really need to handle here...

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

M	source/blender/windowmanager/WM_keymap.h
M	source/blender/windowmanager/intern/wm_keymap.c

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

diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index d8787c9..cd42f36 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -107,7 +107,7 @@ int			WM_keymap_map_type_get(struct wmKeyMapItem *kmi);
 const char *WM_key_event_string(const short type, const bool compact);
 int WM_keymap_item_raw_to_string(
         const short shift, const short ctrl, const short alt, const short oskey, const short keymodifier,
-        const short type, const bool compact, const int len, char *r_str);
+        const short val, const short type, const bool compact, const int len, char *r_str);
 int         WM_key_event_operator_id(
         const struct bContext *C, const char *opname, int opcontext,
         struct IDProperty *properties, const bool is_hotkey,
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 29d54f4..e65ce47 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -902,7 +902,7 @@ const char *WM_key_event_string(const short type, const bool compact)
 /* TODO: also support (some) value, like e.g. double-click? */
 int WM_keymap_item_raw_to_string(
         const short shift, const short ctrl, const short alt, const short oskey,
-        const short keymodifier, const short type, const bool compact,
+        const short keymodifier, const short val, const short type, const bool compact,
         const int len, char *r_str)
 {
 #define ADD_SEP if (p != buf) *p++ = ' '; (void)0
@@ -953,6 +953,9 @@ int WM_keymap_item_raw_to_string(
 
 	if (type) {
 		ADD_SEP;
+		if (val == KM_DBL_CLICK) {
+			p += BLI_strcpy_rlen(p, IFACE_("dbl-"));
+		}
 		p += BLI_strcpy_rlen(p, WM_key_event_string(type, compact));
 	}
 
@@ -968,7 +971,8 @@ int WM_keymap_item_raw_to_string(
 int WM_keymap_item_to_string(wmKeyMapItem *kmi, const bool compact, const int len, char *r_str)
 {
 	return WM_keymap_item_raw_to_string(
-	            kmi->shift, kmi->ctrl, kmi->alt, kmi->oskey, kmi->keymodifier, kmi->type, compact, len, r_str);
+	            kmi->shift, kmi->ctrl, kmi->alt, kmi->oskey, kmi->keymodifier, kmi->val, kmi->type,
+	            compact, len, r_str);
 }
 
 int WM_modalkeymap_operator_items_to_string(




More information about the Bf-blender-cvs mailing list