[Bf-blender-cvs] [9535dbcee0b] master: UI: Gray out shortcut indicator in search menus

Julian Eisel noreply at git.blender.org
Tue May 5 16:24:32 CEST 2020


Commit: 9535dbcee0bde24f11457d17d0f4cd5424711e86
Author: Julian Eisel
Date:   Tue May 5 15:29:49 2020 +0200
Branches: master
https://developer.blender.org/rB9535dbcee0bde24f11457d17d0f4cd5424711e86

UI: Gray out shortcut indicator in search menus

In other menus we already gray out the shortcut string, just in the search menu
that wasn't the case.

We may also want to draw other hints like this in the future, e.g. the library
name for linked data-blocks in search menus. And then it's also nicer to have
it grayed out to separate it visually from the data-block name.

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

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

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

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0d4eff2ba31..231c2093143 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -5409,21 +5409,6 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
     }
   }
 
-  /* part text right aligned */
-  if (use_sep) {
-    if (cpoin) {
-      rect->xmax = _rect.xmax - 5;
-      UI_fontstyle_draw(fstyle,
-                        rect,
-                        cpoin + 1,
-                        wt->wcol.text,
-                        &(struct uiFontStyleDraw_Params){
-                            .align = UI_STYLE_TEXT_RIGHT,
-                        });
-      *cpoin = UI_SEP_CHAR;
-    }
-  }
-
   /* restore rect, was messed with */
   *rect = _rect;
 
@@ -5440,6 +5425,24 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
     UI_icon_draw_ex(xs, ys, iconid, aspect, 1.0f, 0.0f, wt->wcol.text, false);
     GPU_blend(false);
   }
+
+  /* part text right aligned */
+  if (use_sep) {
+    if (cpoin) {
+      /* Set inactive state for grayed out text. */
+      wt->state(wt, state | UI_BUT_INACTIVE, 0);
+
+      rect->xmax = _rect.xmax - 5;
+      UI_fontstyle_draw(fstyle,
+                        rect,
+                        cpoin + 1,
+                        wt->wcol.text,
+                        &(struct uiFontStyleDraw_Params){
+                            .align = UI_STYLE_TEXT_RIGHT,
+                        });
+      *cpoin = UI_SEP_CHAR;
+    }
+  }
 }
 
 void ui_draw_preview_item(



More information about the Bf-blender-cvs mailing list