UI: Add superimposed + and - icons for file number

Brings back + and - icons to the file name button, but now as
superimposed icons.
This commit is contained in:
Julian Eisel 2019-09-09 16:36:10 +02:00
parent 828905190e
commit 2aa3e9c67c
1 changed files with 10 additions and 1 deletions

View File

@ -132,7 +132,7 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
uiBlock *block = uiLayoutGetBlock(pa->layout);
uiBut *but;
uiLayout *row;
PointerRNA params_rna_ptr;
PointerRNA params_rna_ptr, *but_extra_rna_ptr;
const bool overwrite_alert = file_draw_check_exists(sfile);
const bool windows_layout =
@ -176,6 +176,15 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *pa)
* immediate ui_apply_but_func but only after button deactivates */
UI_but_funcN_set(but, file_filename_enter_handle, NULL, but);
if (params->action_type == FILE_SAVE) {
but_extra_rna_ptr = UI_but_extra_operator_icon_add(
but, "FILE_OT_filenum", WM_OP_EXEC_REGION_WIN, ICON_ADD);
RNA_int_set(but_extra_rna_ptr, "increment", 1);
but_extra_rna_ptr = UI_but_extra_operator_icon_add(
but, "FILE_OT_filenum", WM_OP_EXEC_REGION_WIN, ICON_REMOVE);
RNA_int_set(but_extra_rna_ptr, "increment", -1);
}
/* check if this overrides a file and if the operator option is used */
if (overwrite_alert) {
UI_but_flag_enable(but, UI_BUT_REDALERT);