Windows: use more standard button layout in quit dialog
macOS and Linux remain the same as before. Ref D3118.
This commit is contained in:
@@ -2900,6 +2900,31 @@ static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_dat
|
||||
wm_generic_callback_free(callback);
|
||||
}
|
||||
|
||||
static void wm_block_file_close_cancel_button(uiBlock *block, GenericCallback *post_action)
|
||||
{
|
||||
uiBut *but = uiDefIconTextBut(
|
||||
block, UI_BTYPE_BUT, 0, 0, IFACE_("Cancel"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
|
||||
UI_but_func_set(but, wm_block_file_close_cancel, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
}
|
||||
|
||||
static void wm_block_file_close_discard_button(uiBlock *block, GenericCallback *post_action)
|
||||
{
|
||||
uiBut *but = uiDefIconTextBut(
|
||||
block, UI_BTYPE_BUT, 0, 0, IFACE_("Discard Changes"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
|
||||
UI_but_func_set(but, wm_block_file_close_discard, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
}
|
||||
|
||||
static void wm_block_file_close_save_button(uiBlock *block, GenericCallback *post_action)
|
||||
{
|
||||
uiBut *but = uiDefIconTextBut(
|
||||
block, UI_BTYPE_BUT, 0, 0, IFACE_("Save"), 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, "");
|
||||
UI_but_func_set(but, wm_block_file_close_save, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT);
|
||||
}
|
||||
|
||||
static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegion *ar, void *arg1)
|
||||
{
|
||||
GenericCallback *post_action = (GenericCallback *)arg1;
|
||||
@@ -2923,6 +2948,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
|
||||
0,
|
||||
style);
|
||||
|
||||
/* Title */
|
||||
bool blend_file_is_saved = BKE_main_blendfile_path(bmain)[0] != '\0';
|
||||
if (blend_file_is_saved) {
|
||||
uiItemL(layout, "This file has unsaved changes.", ICON_INFO);
|
||||
@@ -2931,6 +2957,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
|
||||
uiItemL(layout, "This file has not been saved yet.", ICON_INFO);
|
||||
}
|
||||
|
||||
/* Image Saving */
|
||||
ReportList reports;
|
||||
BKE_reports_init(&reports, RPT_STORE);
|
||||
uint modified_images_count = ED_image_save_all_modified_info(C, &reports);
|
||||
@@ -2967,70 +2994,43 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi
|
||||
|
||||
uiItemL(layout, "", ICON_NONE);
|
||||
|
||||
uiBut *but;
|
||||
/* Buttons */
|
||||
#ifdef _WIN32
|
||||
const bool windows_layout = true;
|
||||
#else
|
||||
const bool windows_layout = false;
|
||||
#endif
|
||||
|
||||
uiLayout *split = uiLayoutSplit(layout, 0.0f, true);
|
||||
uiLayout *col = uiLayoutColumn(split, false);
|
||||
|
||||
but = uiDefIconTextBut(block,
|
||||
UI_BTYPE_BUT,
|
||||
0,
|
||||
0,
|
||||
IFACE_("Cancel"),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
UI_but_func_set(but, wm_block_file_close_cancel, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
if (windows_layout) {
|
||||
/* Windows standard layout. */
|
||||
uiLayout *col = uiLayoutColumn(split, false);
|
||||
uiItemS(col);
|
||||
|
||||
/* empty space between buttons */
|
||||
col = uiLayoutColumn(split, false);
|
||||
uiItemS(col);
|
||||
col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_save_button(block, post_action);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
but = uiDefIconTextBut(block,
|
||||
UI_BTYPE_BUT,
|
||||
0,
|
||||
0,
|
||||
IFACE_("Discard Changes"),
|
||||
0,
|
||||
0,
|
||||
50,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
UI_but_func_set(but, wm_block_file_close_discard, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_discard_button(block, post_action);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
but = uiDefIconTextBut(block,
|
||||
UI_BTYPE_BUT,
|
||||
0,
|
||||
0,
|
||||
IFACE_("Save"),
|
||||
0,
|
||||
0,
|
||||
50,
|
||||
UI_UNIT_Y,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
UI_but_func_set(but, wm_block_file_close_save, block, post_action);
|
||||
UI_but_drawflag_disable(but, UI_BUT_TEXT_LEFT);
|
||||
UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT);
|
||||
col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_cancel_button(block, post_action);
|
||||
}
|
||||
else {
|
||||
/* macOS and Linux standard layout. */
|
||||
uiLayout *col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_cancel_button(block, post_action);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
uiItemS(col);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_discard_button(block, post_action);
|
||||
|
||||
col = uiLayoutColumn(split, false);
|
||||
wm_block_file_close_save_button(block, post_action);
|
||||
}
|
||||
|
||||
UI_block_bounds_set_centered(block, 10);
|
||||
return block;
|
||||
|
||||
Reference in New Issue
Block a user