[Bf-blender-cvs] [a009f2659fb] blender2.8: UI: keep statusbar keymap icons in same position, if there is enough space.

Brecht Van Lommel noreply at git.blender.org
Thu Jun 28 00:20:19 CEST 2018


Commit: a009f2659fb627c62a3a2444e1f6d913ff63af2b
Author: Brecht Van Lommel
Date:   Wed Jun 27 23:59:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa009f2659fb627c62a3a2444e1f6d913ff63af2b

UI: keep statusbar keymap icons in same position, if there is enough space.

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

M	source/blender/editors/interface/interface_templates.c

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

diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 041dc56cf92..43824c59af4 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -4309,22 +4309,23 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
 
 	/* Otherwise should cursor keymap status. */
 	for (int i = 0; i < 3; i++) {
-		uiLayout *box = uiLayoutRow(layout, true);
+		uiLayout *box = uiLayoutRow(layout, false);
+		uiLayout *col = uiLayoutColumn(box, false);
+		uiLayout *row = uiLayoutRow(col, true);
+		uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
 
 		const char *msg = WM_window_cursor_keymap_status_get(win, i, 0);
 		const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1);
 
-		if (msg || msg_drag) {
-			uiItemL(box, msg ? msg : "", (ICON_MOUSE_LMB + i));
+		uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
 
-			if (msg_drag) {
-				uiItemL(box, msg_drag, ICON_MOUSE_DRAG);
-			}
-
-			if (i != 2) {
-				uiItemS(layout);
-			}
+		if (msg_drag) {
+			uiItemL(row, msg_drag, ICON_MOUSE_DRAG);
 		}
+
+		/* Use trick with empty string to keep icons in same position. */
+		row = uiLayoutRow(col, false);
+		uiItemL(row, "                                                        ", ICON_NONE);
 	}
 }



More information about the Bf-blender-cvs mailing list