Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYevgeny Makarov <jenkm>2020-10-29 02:22:37 +0300
committerHarley Acheson <harley.acheson@gmail.com>2020-10-29 02:22:37 +0300
commitb0a9a04f620120fd6b80ec985676f1a706a8495d (patch)
treef222cf9ce9806fe36c76aab886eaacb19a258727 /source/blender/windowmanager/intern/wm_files.c
parent6bf043ac946f39f2ac3063feb7e7cfe7b7a6ba18 (diff)
UI: Improvements to Close File Dialog
Improved alignment of items on the File Close Dialog. Differential Revision: https://developer.blender.org/D6938 Reviewed by Hans Goudey
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 87640999f08..0a60d993c37 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -3190,8 +3190,13 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
const int text_points_max = MAX2(style->widget.points, style->widgetlabel.points);
const int dialog_width = icon_size + (text_points_max * 34 * U.dpi_fac);
+ /* By default, the space between icon and text/buttons will be equal to the 'columnspace',
+ this extra padding will add some space by increasing the left column width,
+ making the icon placement more symmetrical, between the block edge and the text. */
+ const float icon_padding = 6.0f * U.dpi_fac;
/* Calculate icon column factor. */
- const float split_factor = (float)icon_size / (float)(dialog_width - style->columnspace);
+ const float split_factor = ((float)icon_size + icon_padding) /
+ (float)(dialog_width - style->columnspace);
uiBlock *block = UI_block_begin(C, region, close_file_dialog_name, UI_EMBOSS);
@@ -3207,8 +3212,10 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
uiLayout *split_block = uiLayoutSplit(block_layout, split_factor, false);
/* Alert Icon. */
- uiLayout *layout = uiLayoutColumn(split_block, false);
- uiDefButAlert(block, ALERT_ICON_QUESTION, 0, 0, 0, icon_size);
+ uiLayout *layout = uiLayoutRow(split_block, false);
+ /* Using 'align_left' with 'row' avoids stretching the icon along the width of column. */
+ uiLayoutSetAlignment(layout, UI_LAYOUT_ALIGN_LEFT);
+ uiDefButAlert(block, ALERT_ICON_QUESTION, 0, 0, icon_size, icon_size);
/* The rest of the content on the right. */
layout = uiLayoutColumn(split_block, false);
@@ -3235,7 +3242,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
LISTBASE_FOREACH (Report *, report, &reports.list) {
uiLayout *row = uiLayoutColumn(layout, false);
uiLayoutSetScaleY(row, 0.6f);
- uiItemS_ex(row, 1.2f);
+ uiItemS(row);
/* Error messages created in ED_image_save_all_modified_info() can be long,
* but are made to separate into two parts at first colon between text and paths.
@@ -3262,7 +3269,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
sizeof(message),
"Save %u modified image(s)",
modified_images_count);
- uiItemS_ex(layout, 2.0f);
+ uiItemS(layout);
uiDefButBitC(block,
UI_BTYPE_CHECKBOX,
1,
@@ -3282,7 +3289,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
BKE_reports_clear(&reports);
- uiItemS_ex(layout, 1.0f);
+ uiItemS_ex(layout, modified_images_count > 0 ? 2.0f : 4.0f);
/* Buttons. */
#ifdef _WIN32
@@ -3294,13 +3301,10 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
if (windows_layout) {
/* Windows standard layout. */
- uiLayout *split = uiLayoutSplit(block_layout, 0.174f, true);
+ uiLayout *split = uiLayoutSplit(layout, 0.0f, true);
uiLayoutSetScaleY(split, 1.2f);
uiLayoutColumn(split, false);
- uiItemS(layout);
-
- uiLayoutColumn(split, false);
wm_block_file_close_save_button(block, post_action);
uiLayoutColumn(split, false);
@@ -3312,21 +3316,16 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C,
else {
/* Non-Windows layout (macOS and Linux). */
- uiLayout *split = uiLayoutSplit(block_layout, 0.167f, true);
+ uiLayout *split = uiLayoutSplit(layout, 0.3f, true);
uiLayoutSetScaleY(split, 1.2f);
- layout = uiLayoutColumn(split, false);
- uiItemS(layout);
-
- /* Split button area into two sections: 40/60. */
- uiLayout *split_left = uiLayoutSplit(split, 0.40f, true);
-
- /* First button uses 75% of left side (30% of original). */
- uiLayoutSplit(split_left, 0.75f, true);
+ uiLayoutColumn(split, false);
wm_block_file_close_discard_button(block, post_action);
- /* The right side is split 50/50 (each 30% of original). */
- uiLayout *split_right = uiLayoutSplit(split_left, 0.50f, true);
+ uiLayout *split_right = uiLayoutSplit(split, 0.1f, true);
+
+ uiLayoutColumn(split_right, false);
+ /* Empty space. */
uiLayoutColumn(split_right, false);
wm_block_file_close_cancel_button(block, post_action);