[Bf-blender-cvs] [bdf260a1b8f] master: UI: Avoid manual right-alignment of text in splash screen

Yevgeny Makarov noreply at git.blender.org
Wed Apr 15 11:49:40 CEST 2020


Commit: bdf260a1b8f83373695fe8375f4a533e5f018549
Author: Yevgeny Makarov
Date:   Wed Apr 15 11:46:06 2020 +0200
Branches: master
https://developer.blender.org/rBbdf260a1b8f83373695fe8375f4a533e5f018549

UI: Avoid manual right-alignment of text in splash screen

Can use existing layout features for right-alignment instead.

Differential Revision: https://developer.blender.org/D6549

Reviewed by: William Reynish, Julian Eisel

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

M	source/blender/windowmanager/intern/wm_splash_screen.c

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

diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c
index f953cc6707c..613ac5938bd 100644
--- a/source/blender/windowmanager/intern/wm_splash_screen.c
+++ b/source/blender/windowmanager/intern/wm_splash_screen.c
@@ -83,28 +83,12 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x,
     return;
   }
 
-  const uiStyle *style = UI_style_get();
-
-  BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.pixelsize * U.dpi);
-  int label_width = BLF_width(style->widgetlabel.uifont_id, label, strlen(label));
-  label_width = label_width + U.widget_unit;
-
   UI_block_emboss_set(block, UI_EMBOSS_NONE);
 
-  uiBut *but = uiDefBut(block,
-                        UI_BTYPE_LABEL,
-                        0,
-                        label,
-                        x - label_width,
-                        *y,
-                        label_width,
-                        UI_UNIT_Y,
-                        NULL,
-                        0,
-                        0,
-                        0,
-                        0,
-                        NULL);
+  uiBut *but = uiDefBut(
+      block, UI_BTYPE_LABEL, 0, label, 0, *y, x, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL);
+  UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
+  UI_but_drawflag_enable(but, UI_BUT_TEXT_RIGHT);
 
   /* 1 = UI_SELECT, internal flag to draw in white. */
   UI_but_flag_enable(but, 1);



More information about the Bf-blender-cvs mailing list