diff options
author | Yevgeny Makarov <jenkm> | 2021-02-21 19:26:55 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-02-21 19:32:33 +0300 |
commit | 0c62906a4145b242d5ed772209038f65d7b493a8 (patch) | |
tree | 65964e982e03708eb3b3e7197948a021e8aa30f1 /source/blender/windowmanager/intern/wm_splash_screen.c | |
parent | 08dbc4f996e4e95f3ab64f7bb3e1193700c585f5 (diff) |
UI: Correct the text alignment in the quick setup (splash screen) dialog
The "quick setup" dialog is actually a 'menu', and the "splash screen" block
contains the UI_BLOCK_LOOP flag which causes the buttons' text to align
to the left, however, usually regular buttons have centered text.
As a workaround, add the UI_BLOCK_QUICK_SETUP flag which prevents
the text from being left-aligned.
Differential Revision: https://developer.blender.org/D10486
Reviewed by: Julian Eisel
Diffstat (limited to 'source/blender/windowmanager/intern/wm_splash_screen.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_splash_screen.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index a3619a69152..ae726e73fe7 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -226,7 +226,26 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE 0, style); - MenuType *mt = WM_menutype_find("WM_MT_splash", true); + MenuType *mt; + char userpref[FILE_MAX]; + const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL); + + if (cfgdir) { + BLI_path_join(userpref, sizeof(userpref), cfgdir, BLENDER_USERPREF_FILE, NULL); + } + + /* Draw setup screen if no preferences have been saved yet. */ + if (!BLI_exists(userpref)) { + mt = WM_menutype_find("WM_MT_splash_quick_setup", true); + + /* The UI_BLOCK_QUICK_SETUP flag prevents the button text from being left-aligned, + as it is for all menus due to the UI_BLOCK_LOOP flag, see in 'ui_def_but'. */ + UI_block_flag_enable(block, UI_BLOCK_QUICK_SETUP); + } + else { + mt = WM_menutype_find("WM_MT_splash", true); + } + if (mt) { UI_menutype_draw(C, mt, layout); } |